<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/google/protobuf/descriptor.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/google/protobuf</a> - descriptor.h<span style="font-size: 80%;"> (source / <a href="descriptor.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:50:33</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Protocol Buffers - Google's data interchange format</a>
<span class="lineNum">       2 </span>            : // Copyright 2008 Google Inc.  All rights reserved.
<span class="lineNum">       3 </span>            : // https://developers.google.com/protocol-buffers/
<span class="lineNum">       4 </span>            : //
<span class="lineNum">       5 </span>            : // Redistribution and use in source and binary forms, with or without
<span class="lineNum">       6 </span>            : // modification, are permitted provided that the following conditions are
<span class="lineNum">       7 </span>            : // met:
<span class="lineNum">       8 </span>            : //
<span class="lineNum">       9 </span>            : //     * Redistributions of source code must retain the above copyright
<span class="lineNum">      10 </span>            : // notice, this list of conditions and the following disclaimer.
<span class="lineNum">      11 </span>            : //     * Redistributions in binary form must reproduce the above
<span class="lineNum">      12 </span>            : // copyright notice, this list of conditions and the following disclaimer
<span class="lineNum">      13 </span>            : // in the documentation and/or other materials provided with the
<span class="lineNum">      14 </span>            : // distribution.
<span class="lineNum">      15 </span>            : //     * Neither the name of Google Inc. nor the names of its
<span class="lineNum">      16 </span>            : // contributors may be used to endorse or promote products derived from
<span class="lineNum">      17 </span>            : // this software without specific prior written permission.
<span class="lineNum">      18 </span>            : //
<span class="lineNum">      19 </span>            : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<span class="lineNum">      20 </span>            : // &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<span class="lineNum">      21 </span>            : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<span class="lineNum">      22 </span>            : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<span class="lineNum">      23 </span>            : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<span class="lineNum">      24 </span>            : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<span class="lineNum">      25 </span>            : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<span class="lineNum">      26 </span>            : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<span class="lineNum">      27 </span>            : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<span class="lineNum">      28 </span>            : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<span class="lineNum">      29 </span>            : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : // Author: kenton@google.com (Kenton Varda)
<span class="lineNum">      32 </span>            : //  Based on original Protocol Buffers design by
<span class="lineNum">      33 </span>            : //  Sanjay Ghemawat, Jeff Dean, and others.
<span class="lineNum">      34 </span>            : //
<span class="lineNum">      35 </span>            : // This file contains classes which describe a type of protocol message.
<span class="lineNum">      36 </span>            : // You can use a message's descriptor to learn at runtime what fields
<span class="lineNum">      37 </span>            : // it contains and what the types of those fields are.  The Message
<span class="lineNum">      38 </span>            : // interface also allows you to dynamically access and modify individual
<span class="lineNum">      39 </span>            : // fields by passing the FieldDescriptor of the field you are interested
<span class="lineNum">      40 </span>            : // in.
<span class="lineNum">      41 </span>            : //
<span class="lineNum">      42 </span>            : // Most users will not care about descriptors, because they will write
<span class="lineNum">      43 </span>            : // code specific to certain protocol types and will simply use the classes
<span class="lineNum">      44 </span>            : // generated by the protocol compiler directly.  Advanced users who want
<span class="lineNum">      45 </span>            : // to operate on arbitrary types (not known at compile time) may want to
<span class="lineNum">      46 </span>            : // read descriptors in order to learn about the contents of a message.
<span class="lineNum">      47 </span>            : // A very small number of users will want to construct their own
<span class="lineNum">      48 </span>            : // Descriptors, either because they are implementing Message manually or
<span class="lineNum">      49 </span>            : // because they are writing something like the protocol compiler.
<span class="lineNum">      50 </span>            : //
<span class="lineNum">      51 </span>            : // For an example of how you might use descriptors, see the code example
<span class="lineNum">      52 </span>            : // at the top of message.h.
<span class="lineNum">      53 </span>            : 
<span class="lineNum">      54 </span>            : #ifndef GOOGLE_PROTOBUF_DESCRIPTOR_H__
<span class="lineNum">      55 </span>            : #define GOOGLE_PROTOBUF_DESCRIPTOR_H__
<span class="lineNum">      56 </span>            : 
<span class="lineNum">      57 </span>            : #include &lt;set&gt;
<span class="lineNum">      58 </span>            : #include &lt;string&gt;
<span class="lineNum">      59 </span>            : #include &lt;vector&gt;
<span class="lineNum">      60 </span>            : #include &lt;google/protobuf/stubs/common.h&gt;
<span class="lineNum">      61 </span>            : 
<span class="lineNum">      62 </span>            : 
<span class="lineNum">      63 </span>            : namespace google {
<span class="lineNum">      64 </span>            : namespace protobuf {
<span class="lineNum">      65 </span>            : 
<span class="lineNum">      66 </span>            : // Defined in this file.
<span class="lineNum">      67 </span>            : class Descriptor;
<span class="lineNum">      68 </span>            : class FieldDescriptor;
<span class="lineNum">      69 </span>            : class OneofDescriptor;
<span class="lineNum">      70 </span>            : class EnumDescriptor;
<span class="lineNum">      71 </span>            : class EnumValueDescriptor;
<span class="lineNum">      72 </span>            : class ServiceDescriptor;
<span class="lineNum">      73 </span>            : class MethodDescriptor;
<span class="lineNum">      74 </span>            : class FileDescriptor;
<span class="lineNum">      75 </span>            : class DescriptorDatabase;
<span class="lineNum">      76 </span>            : class DescriptorPool;
<span class="lineNum">      77 </span>            : 
<span class="lineNum">      78 </span>            : // Defined in descriptor.proto
<span class="lineNum">      79 </span>            : class DescriptorProto;
<span class="lineNum">      80 </span>            : class FieldDescriptorProto;
<span class="lineNum">      81 </span>            : class OneofDescriptorProto;
<span class="lineNum">      82 </span>            : class EnumDescriptorProto;
<span class="lineNum">      83 </span>            : class EnumValueDescriptorProto;
<span class="lineNum">      84 </span>            : class ServiceDescriptorProto;
<span class="lineNum">      85 </span>            : class MethodDescriptorProto;
<span class="lineNum">      86 </span>            : class FileDescriptorProto;
<span class="lineNum">      87 </span>            : class MessageOptions;
<span class="lineNum">      88 </span>            : class FieldOptions;
<span class="lineNum">      89 </span>            : class EnumOptions;
<span class="lineNum">      90 </span>            : class EnumValueOptions;
<span class="lineNum">      91 </span>            : class ServiceOptions;
<span class="lineNum">      92 </span>            : class MethodOptions;
<span class="lineNum">      93 </span>            : class FileOptions;
<span class="lineNum">      94 </span>            : class UninterpretedOption;
<span class="lineNum">      95 </span>            : class SourceCodeInfo;
<span class="lineNum">      96 </span>            : 
<span class="lineNum">      97 </span>            : // Defined in message.h
<span class="lineNum">      98 </span>            : class Message;
<span class="lineNum">      99 </span>            : 
<span class="lineNum">     100 </span>            : // Defined in descriptor.cc
<span class="lineNum">     101 </span>            : class DescriptorBuilder;
<span class="lineNum">     102 </span>            : class FileDescriptorTables;
<span class="lineNum">     103 </span>            : 
<span class="lineNum">     104 </span>            : // Defined in unknown_field_set.h.
<span class="lineNum">     105 </span>            : class UnknownField;
<span class="lineNum">     106 </span>            : 
<span class="lineNum">     107 </span>            : // NB, all indices are zero-based.
<span class="lineNum">     108 </span>            : struct SourceLocation {
<span class="lineNum">     109 </span>            :   int start_line;
<span class="lineNum">     110 </span>            :   int end_line;
<span class="lineNum">     111 </span>            :   int start_column;
<span class="lineNum">     112 </span>            :   int end_column;
<span class="lineNum">     113 </span>            : 
<span class="lineNum">     114 </span>            :   // Doc comments found at the source location.
<span class="lineNum">     115 </span>            :   // TODO(kenton):  Maybe this struct should have been named SourceInfo or
<span class="lineNum">     116 </span>            :   //   something instead.  Oh well.
<span class="lineNum">     117 </span>            :   string leading_comments;
<span class="lineNum">     118 </span>            :   string trailing_comments;
<span class="lineNum">     119 </span>            : };
<span class="lineNum">     120 </span>            : 
<span class="lineNum">     121 </span>            : // Describes a type of protocol message, or a particular group within a
<span class="lineNum">     122 </span>            : // message.  To obtain the Descriptor for a given message object, call
<span class="lineNum">     123 </span>            : // Message::GetDescriptor().  Generated message classes also have a
<span class="lineNum">     124 </span>            : // static method called descriptor() which returns the type's descriptor.
<span class="lineNum">     125 </span>            : // Use DescriptorPool to construct your own descriptors.
<span class="lineNum">     126 </span>            : class LIBPROTOBUF_EXPORT Descriptor {
<span class="lineNum">     127 </span>            :  public:
<span class="lineNum">     128 </span>            :   // The name of the message type, not including its scope.
<span class="lineNum">     129 </span>            :   const string&amp; name() const;
<span class="lineNum">     130 </span>            : 
<span class="lineNum">     131 </span>            :   // The fully-qualified name of the message type, scope delimited by
<span class="lineNum">     132 </span>            :   // periods.  For example, message type &quot;Foo&quot; which is declared in package
<span class="lineNum">     133 </span>            :   // &quot;bar&quot; has full name &quot;bar.Foo&quot;.  If a type &quot;Baz&quot; is nested within
<span class="lineNum">     134 </span>            :   // Foo, Baz's full_name is &quot;bar.Foo.Baz&quot;.  To get only the part that
<span class="lineNum">     135 </span>            :   // comes after the last '.', use name().
<span class="lineNum">     136 </span>            :   const string&amp; full_name() const;
<span class="lineNum">     137 </span>            : 
<span class="lineNum">     138 </span>            :   // Index of this descriptor within the file or containing type's message
<span class="lineNum">     139 </span>            :   // type array.
<span class="lineNum">     140 </span>            :   int index() const;
<span class="lineNum">     141 </span>            : 
<span class="lineNum">     142 </span>            :   // The .proto file in which this message type was defined.  Never NULL.
<span class="lineNum">     143 </span>            :   const FileDescriptor* file() const;
<span class="lineNum">     144 </span>            : 
<span class="lineNum">     145 </span>            :   // If this Descriptor describes a nested type, this returns the type
<span class="lineNum">     146 </span>            :   // in which it is nested.  Otherwise, returns NULL.
<span class="lineNum">     147 </span>            :   const Descriptor* containing_type() const;
<span class="lineNum">     148 </span>            : 
<span class="lineNum">     149 </span>            :   // Get options for this message type.  These are specified in the .proto file
<span class="lineNum">     150 </span>            :   // by placing lines like &quot;option foo = 1234;&quot; in the message definition.
<span class="lineNum">     151 </span>            :   // Allowed options are defined by MessageOptions in
<span class="lineNum">     152 </span>            :   // google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">     153 </span>            :   // message.
<span class="lineNum">     154 </span>            :   const MessageOptions&amp; options() const;
<span class="lineNum">     155 </span>            : 
<span class="lineNum">     156 </span>            :   // Write the contents of this Descriptor into the given DescriptorProto.
<span class="lineNum">     157 </span>            :   // The target DescriptorProto must be clear before calling this; if it
<span class="lineNum">     158 </span>            :   // isn't, the result may be garbage.
<span class="lineNum">     159 </span>            :   void CopyTo(DescriptorProto* proto) const;
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span>            :   // Write the contents of this decriptor in a human-readable form. Output
<span class="lineNum">     162 </span>            :   // will be suitable for re-parsing.
<span class="lineNum">     163 </span>            :   string DebugString() const;
<span class="lineNum">     164 </span>            : 
<span class="lineNum">     165 </span>            :   // Returns true if this is a placeholder for an unknown type. This will
<span class="lineNum">     166 </span>            :   // only be the case if this descriptor comes from a DescriptorPool
<span class="lineNum">     167 </span>            :   // with AllowUnknownDependencies() set.
<span class="lineNum">     168 </span>            :   bool is_placeholder() const;
<span class="lineNum">     169 </span>            : 
<span class="lineNum">     170 </span>            :   // Field stuff -----------------------------------------------------
<span class="lineNum">     171 </span>            : 
<span class="lineNum">     172 </span>            :   // The number of fields in this message type.
<span class="lineNum">     173 </span>            :   int field_count() const;
<span class="lineNum">     174 </span>            :   // Gets a field by index, where 0 &lt;= index &lt; field_count().
<span class="lineNum">     175 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     176 </span>            :   const FieldDescriptor* field(int index) const;
<span class="lineNum">     177 </span>            : 
<span class="lineNum">     178 </span>            :   // Looks up a field by declared tag number.  Returns NULL if no such field
<span class="lineNum">     179 </span>            :   // exists.
<span class="lineNum">     180 </span>            :   const FieldDescriptor* FindFieldByNumber(int number) const;
<span class="lineNum">     181 </span>            :   // Looks up a field by name.  Returns NULL if no such field exists.
<span class="lineNum">     182 </span>            :   const FieldDescriptor* FindFieldByName(const string&amp; name) const;
<span class="lineNum">     183 </span>            : 
<span class="lineNum">     184 </span>            :   // Looks up a field by lowercased name (as returned by lowercase_name()).
<span class="lineNum">     185 </span>            :   // This lookup may be ambiguous if multiple field names differ only by case,
<span class="lineNum">     186 </span>            :   // in which case the field returned is chosen arbitrarily from the matches.
<span class="lineNum">     187 </span>            :   const FieldDescriptor* FindFieldByLowercaseName(
<span class="lineNum">     188 </span>            :       const string&amp; lowercase_name) const;
<span class="lineNum">     189 </span>            : 
<span class="lineNum">     190 </span>            :   // Looks up a field by camel-case name (as returned by camelcase_name()).
<span class="lineNum">     191 </span>            :   // This lookup may be ambiguous if multiple field names differ in a way that
<span class="lineNum">     192 </span>            :   // leads them to have identical camel-case names, in which case the field
<span class="lineNum">     193 </span>            :   // returned is chosen arbitrarily from the matches.
<span class="lineNum">     194 </span>            :   const FieldDescriptor* FindFieldByCamelcaseName(
<span class="lineNum">     195 </span>            :       const string&amp; camelcase_name) const;
<span class="lineNum">     196 </span>            : 
<span class="lineNum">     197 </span>            :   // The number of oneofs in this message type.
<span class="lineNum">     198 </span>            :   int oneof_decl_count() const;
<span class="lineNum">     199 </span>            :   // Get a oneof by index, where 0 &lt;= index &lt; oneof_decl_count().
<span class="lineNum">     200 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     201 </span>            :   const OneofDescriptor* oneof_decl(int index) const;
<span class="lineNum">     202 </span>            : 
<span class="lineNum">     203 </span>            :   // Looks up a oneof by name.  Returns NULL if no such oneof exists.
<span class="lineNum">     204 </span>            :   const OneofDescriptor* FindOneofByName(const string&amp; name) const;
<span class="lineNum">     205 </span>            : 
<span class="lineNum">     206 </span>            :   // Nested type stuff -----------------------------------------------
<span class="lineNum">     207 </span>            : 
<span class="lineNum">     208 </span>            :   // The number of nested types in this message type.
<span class="lineNum">     209 </span>            :   int nested_type_count() const;
<span class="lineNum">     210 </span>            :   // Gets a nested type by index, where 0 &lt;= index &lt; nested_type_count().
<span class="lineNum">     211 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     212 </span>            :   const Descriptor* nested_type(int index) const;
<span class="lineNum">     213 </span>            : 
<span class="lineNum">     214 </span>            :   // Looks up a nested type by name.  Returns NULL if no such nested type
<span class="lineNum">     215 </span>            :   // exists.
<span class="lineNum">     216 </span>            :   const Descriptor* FindNestedTypeByName(const string&amp; name) const;
<span class="lineNum">     217 </span>            : 
<span class="lineNum">     218 </span>            :   // Enum stuff ------------------------------------------------------
<span class="lineNum">     219 </span>            : 
<span class="lineNum">     220 </span>            :   // The number of enum types in this message type.
<span class="lineNum">     221 </span>            :   int enum_type_count() const;
<span class="lineNum">     222 </span>            :   // Gets an enum type by index, where 0 &lt;= index &lt; enum_type_count().
<span class="lineNum">     223 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     224 </span>            :   const EnumDescriptor* enum_type(int index) const;
<span class="lineNum">     225 </span>            : 
<span class="lineNum">     226 </span>            :   // Looks up an enum type by name.  Returns NULL if no such enum type exists.
<span class="lineNum">     227 </span>            :   const EnumDescriptor* FindEnumTypeByName(const string&amp; name) const;
<span class="lineNum">     228 </span>            : 
<span class="lineNum">     229 </span>            :   // Looks up an enum value by name, among all enum types in this message.
<span class="lineNum">     230 </span>            :   // Returns NULL if no such value exists.
<span class="lineNum">     231 </span>            :   const EnumValueDescriptor* FindEnumValueByName(const string&amp; name) const;
<span class="lineNum">     232 </span>            : 
<span class="lineNum">     233 </span>            :   // Extensions ------------------------------------------------------
<span class="lineNum">     234 </span>            : 
<span class="lineNum">     235 </span>            :   // A range of field numbers which are designated for third-party
<span class="lineNum">     236 </span>            :   // extensions.
<span class="lineNum">     237 </span>            :   struct ExtensionRange {
<span class="lineNum">     238 </span>            :     int start;  // inclusive
<span class="lineNum">     239 </span>            :     int end;    // exclusive
<span class="lineNum">     240 </span>            :   };
<span class="lineNum">     241 </span>            : 
<span class="lineNum">     242 </span>            :   // The number of extension ranges in this message type.
<span class="lineNum">     243 </span>            :   int extension_range_count() const;
<span class="lineNum">     244 </span>            :   // Gets an extension range by index, where 0 &lt;= index &lt;
<span class="lineNum">     245 </span>            :   // extension_range_count(). These are returned in the order they were defined
<span class="lineNum">     246 </span>            :   // in the .proto file.
<span class="lineNum">     247 </span>            :   const ExtensionRange* extension_range(int index) const;
<span class="lineNum">     248 </span>            : 
<span class="lineNum">     249 </span>            :   // Returns true if the number is in one of the extension ranges.
<span class="lineNum">     250 </span>            :   bool IsExtensionNumber(int number) const;
<span class="lineNum">     251 </span>            : 
<span class="lineNum">     252 </span>            :   // Returns NULL if no extension range contains the given number.
<span class="lineNum">     253 </span>            :   const ExtensionRange* FindExtensionRangeContainingNumber(int number) const;
<span class="lineNum">     254 </span>            : 
<span class="lineNum">     255 </span>            :   // The number of extensions -- extending *other* messages -- that were
<span class="lineNum">     256 </span>            :   // defined nested within this message type's scope.
<span class="lineNum">     257 </span>            :   int extension_count() const;
<span class="lineNum">     258 </span>            :   // Get an extension by index, where 0 &lt;= index &lt; extension_count().
<span class="lineNum">     259 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     260 </span>            :   const FieldDescriptor* extension(int index) const;
<span class="lineNum">     261 </span>            : 
<span class="lineNum">     262 </span>            :   // Looks up a named extension (which extends some *other* message type)
<span class="lineNum">     263 </span>            :   // defined within this message type's scope.
<span class="lineNum">     264 </span>            :   const FieldDescriptor* FindExtensionByName(const string&amp; name) const;
<span class="lineNum">     265 </span>            : 
<span class="lineNum">     266 </span>            :   // Similar to FindFieldByLowercaseName(), but finds extensions defined within
<span class="lineNum">     267 </span>            :   // this message type's scope.
<span class="lineNum">     268 </span>            :   const FieldDescriptor* FindExtensionByLowercaseName(const string&amp; name) const;
<span class="lineNum">     269 </span>            : 
<span class="lineNum">     270 </span>            :   // Similar to FindFieldByCamelcaseName(), but finds extensions defined within
<span class="lineNum">     271 </span>            :   // this message type's scope.
<span class="lineNum">     272 </span>            :   const FieldDescriptor* FindExtensionByCamelcaseName(const string&amp; name) const;
<span class="lineNum">     273 </span>            : 
<span class="lineNum">     274 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     275 </span>            : 
<span class="lineNum">     276 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     277 </span>            :   // extent of this message declaration.  Returns false and leaves
<span class="lineNum">     278 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     279 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     280 </span>            : 
<span class="lineNum">     281 </span>            :  private:
<span class="lineNum">     282 </span>            :   typedef MessageOptions OptionsType;
<span class="lineNum">     283 </span>            : 
<span class="lineNum">     284 </span>            :   // Internal version of DebugString; controls the level of indenting for
<span class="lineNum">     285 </span>            :   // correct depth
<span class="lineNum">     286 </span>            :   void DebugString(int depth, string *contents) const;
<span class="lineNum">     287 </span>            : 
<span class="lineNum">     288 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     289 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     290 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     291 </span>            : 
<span class="lineNum">     292 </span>            :   const string* name_;
<span class="lineNum">     293 </span>            :   const string* full_name_;
<span class="lineNum">     294 </span>            :   const FileDescriptor* file_;
<span class="lineNum">     295 </span>            :   const Descriptor* containing_type_;
<span class="lineNum">     296 </span>            :   const MessageOptions* options_;
<span class="lineNum">     297 </span>            : 
<span class="lineNum">     298 </span>            :   // True if this is a placeholder for an unknown type.
<span class="lineNum">     299 </span>            :   bool is_placeholder_;
<span class="lineNum">     300 </span>            :   // True if this is a placeholder and the type name wasn't fully-qualified.
<span class="lineNum">     301 </span>            :   bool is_unqualified_placeholder_;
<span class="lineNum">     302 </span>            : 
<span class="lineNum">     303 </span>            :   int field_count_;
<span class="lineNum">     304 </span>            :   FieldDescriptor* fields_;
<span class="lineNum">     305 </span>            :   int oneof_decl_count_;
<span class="lineNum">     306 </span>            :   OneofDescriptor* oneof_decls_;
<span class="lineNum">     307 </span>            :   int nested_type_count_;
<span class="lineNum">     308 </span>            :   Descriptor* nested_types_;
<span class="lineNum">     309 </span>            :   int enum_type_count_;
<span class="lineNum">     310 </span>            :   EnumDescriptor* enum_types_;
<span class="lineNum">     311 </span>            :   int extension_range_count_;
<span class="lineNum">     312 </span>            :   ExtensionRange* extension_ranges_;
<span class="lineNum">     313 </span>            :   int extension_count_;
<span class="lineNum">     314 </span>            :   FieldDescriptor* extensions_;
<span class="lineNum">     315 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     316 </span>            :   // of Allocate&lt;Descriptor&gt;() and AllocateArray&lt;Descriptor&gt;() in descriptor.cc
<span class="lineNum">     317 </span>            :   // and update them to initialize the field.
<span class="lineNum">     318 </span>            : 
<span class="lineNum">     319 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     320 </span>            :   Descriptor() {}
<span class="lineNum">     321 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     322 </span>            :   friend class EnumDescriptor;
<span class="lineNum">     323 </span>            :   friend class FieldDescriptor;
<span class="lineNum">     324 </span>            :   friend class OneofDescriptor;
<span class="lineNum">     325 </span>            :   friend class MethodDescriptor;
<span class="lineNum">     326 </span>            :   friend class FileDescriptor;
<span class="lineNum">     327 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Descriptor);
<span class="lineNum">     328 </span>            : };
<span class="lineNum">     329 </span>            : 
<span class="lineNum">     330 </span>            : // Describes a single field of a message.  To get the descriptor for a given
<span class="lineNum">     331 </span>            : // field, first get the Descriptor for the message in which it is defined,
<span class="lineNum">     332 </span>            : // then call Descriptor::FindFieldByName().  To get a FieldDescriptor for
<span class="lineNum">     333 </span>            : // an extension, do one of the following:
<span class="lineNum">     334 </span>            : // - Get the Descriptor or FileDescriptor for its containing scope, then
<span class="lineNum">     335 </span>            : //   call Descriptor::FindExtensionByName() or
<span class="lineNum">     336 </span>            : //   FileDescriptor::FindExtensionByName().
<span class="lineNum">     337 </span>            : // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber().
<span class="lineNum">     338 </span>            : // - Given a Reflection for a message object, call
<span class="lineNum">     339 </span>            : //   Reflection::FindKnownExtensionByName() or
<span class="lineNum">     340 </span>            : //   Reflection::FindKnownExtensionByNumber().
<span class="lineNum">     341 </span>            : // Use DescriptorPool to construct your own descriptors.
<span class="lineNum">     342 </span>            : class LIBPROTOBUF_EXPORT FieldDescriptor {
<span class="lineNum">     343 </span>            :  public:
<span class="lineNum">     344 </span>            :   // Identifies a field type.  0 is reserved for errors.  The order is weird
<span class="lineNum">     345 </span>            :   // for historical reasons.  Types 12 and up are new in proto2.
<span class="lineNum">     346 </span>            :   enum Type {
<span class="lineNum">     347 </span>            :     TYPE_DOUBLE         = 1,   // double, exactly eight bytes on the wire.
<span class="lineNum">     348 </span>            :     TYPE_FLOAT          = 2,   // float, exactly four bytes on the wire.
<span class="lineNum">     349 </span>            :     TYPE_INT64          = 3,   // int64, varint on the wire.  Negative numbers
<span class="lineNum">     350 </span>            :                                // take 10 bytes.  Use TYPE_SINT64 if negative
<span class="lineNum">     351 </span>            :                                // values are likely.
<span class="lineNum">     352 </span>            :     TYPE_UINT64         = 4,   // uint64, varint on the wire.
<span class="lineNum">     353 </span>            :     TYPE_INT32          = 5,   // int32, varint on the wire.  Negative numbers
<span class="lineNum">     354 </span>            :                                // take 10 bytes.  Use TYPE_SINT32 if negative
<span class="lineNum">     355 </span>            :                                // values are likely.
<span class="lineNum">     356 </span>            :     TYPE_FIXED64        = 6,   // uint64, exactly eight bytes on the wire.
<span class="lineNum">     357 </span>            :     TYPE_FIXED32        = 7,   // uint32, exactly four bytes on the wire.
<span class="lineNum">     358 </span>            :     TYPE_BOOL           = 8,   // bool, varint on the wire.
<span class="lineNum">     359 </span>            :     TYPE_STRING         = 9,   // UTF-8 text.
<span class="lineNum">     360 </span>            :     TYPE_GROUP          = 10,  // Tag-delimited message.  Deprecated.
<span class="lineNum">     361 </span>            :     TYPE_MESSAGE        = 11,  // Length-delimited message.
<span class="lineNum">     362 </span>            : 
<span class="lineNum">     363 </span>            :     TYPE_BYTES          = 12,  // Arbitrary byte array.
<span class="lineNum">     364 </span>            :     TYPE_UINT32         = 13,  // uint32, varint on the wire
<span class="lineNum">     365 </span>            :     TYPE_ENUM           = 14,  // Enum, varint on the wire
<span class="lineNum">     366 </span>            :     TYPE_SFIXED32       = 15,  // int32, exactly four bytes on the wire
<span class="lineNum">     367 </span>            :     TYPE_SFIXED64       = 16,  // int64, exactly eight bytes on the wire
<span class="lineNum">     368 </span>            :     TYPE_SINT32         = 17,  // int32, ZigZag-encoded varint on the wire
<span class="lineNum">     369 </span>            :     TYPE_SINT64         = 18,  // int64, ZigZag-encoded varint on the wire
<span class="lineNum">     370 </span>            : 
<span class="lineNum">     371 </span>            :     MAX_TYPE            = 18,  // Constant useful for defining lookup tables
<span class="lineNum">     372 </span>            :                                // indexed by Type.
<span class="lineNum">     373 </span>            :   };
<span class="lineNum">     374 </span>            : 
<span class="lineNum">     375 </span>            :   // Specifies the C++ data type used to represent the field.  There is a
<span class="lineNum">     376 </span>            :   // fixed mapping from Type to CppType where each Type maps to exactly one
<span class="lineNum">     377 </span>            :   // CppType.  0 is reserved for errors.
<span class="lineNum">     378 </span>            :   enum CppType {
<span class="lineNum">     379 </span>            :     CPPTYPE_INT32       = 1,     // TYPE_INT32, TYPE_SINT32, TYPE_SFIXED32
<span class="lineNum">     380 </span>            :     CPPTYPE_INT64       = 2,     // TYPE_INT64, TYPE_SINT64, TYPE_SFIXED64
<span class="lineNum">     381 </span>            :     CPPTYPE_UINT32      = 3,     // TYPE_UINT32, TYPE_FIXED32
<span class="lineNum">     382 </span>            :     CPPTYPE_UINT64      = 4,     // TYPE_UINT64, TYPE_FIXED64
<span class="lineNum">     383 </span>            :     CPPTYPE_DOUBLE      = 5,     // TYPE_DOUBLE
<span class="lineNum">     384 </span>            :     CPPTYPE_FLOAT       = 6,     // TYPE_FLOAT
<span class="lineNum">     385 </span>            :     CPPTYPE_BOOL        = 7,     // TYPE_BOOL
<span class="lineNum">     386 </span>            :     CPPTYPE_ENUM        = 8,     // TYPE_ENUM
<span class="lineNum">     387 </span>            :     CPPTYPE_STRING      = 9,     // TYPE_STRING, TYPE_BYTES
<span class="lineNum">     388 </span>            :     CPPTYPE_MESSAGE     = 10,    // TYPE_MESSAGE, TYPE_GROUP
<span class="lineNum">     389 </span>            : 
<span class="lineNum">     390 </span>            :     MAX_CPPTYPE         = 10,    // Constant useful for defining lookup tables
<span class="lineNum">     391 </span>            :                                  // indexed by CppType.
<span class="lineNum">     392 </span>            :   };
<span class="lineNum">     393 </span>            : 
<span class="lineNum">     394 </span>            :   // Identifies whether the field is optional, required, or repeated.  0 is
<span class="lineNum">     395 </span>            :   // reserved for errors.
<span class="lineNum">     396 </span>            :   enum Label {
<span class="lineNum">     397 </span>            :     LABEL_OPTIONAL      = 1,    // optional
<span class="lineNum">     398 </span>            :     LABEL_REQUIRED      = 2,    // required
<span class="lineNum">     399 </span>            :     LABEL_REPEATED      = 3,    // repeated
<span class="lineNum">     400 </span>            : 
<span class="lineNum">     401 </span>            :     MAX_LABEL           = 3,    // Constant useful for defining lookup tables
<span class="lineNum">     402 </span>            :                                 // indexed by Label.
<span class="lineNum">     403 </span>            :   };
<span class="lineNum">     404 </span>            : 
<span class="lineNum">     405 </span>            :   // Valid field numbers are positive integers up to kMaxNumber.
<span class="lineNum">     406 </span>            :   static const int kMaxNumber = (1 &lt;&lt; 29) - 1;
<span class="lineNum">     407 </span>            : 
<span class="lineNum">     408 </span>            :   // First field number reserved for the protocol buffer library implementation.
<span class="lineNum">     409 </span>            :   // Users may not declare fields that use reserved numbers.
<span class="lineNum">     410 </span>            :   static const int kFirstReservedNumber = 19000;
<span class="lineNum">     411 </span>            :   // Last field number reserved for the protocol buffer library implementation.
<span class="lineNum">     412 </span>            :   // Users may not declare fields that use reserved numbers.
<span class="lineNum">     413 </span>            :   static const int kLastReservedNumber  = 19999;
<span class="lineNum">     414 </span>            : 
<span class="lineNum">     415 </span>            :   const string&amp; name() const;        // Name of this field within the message.
<span class="lineNum">     416 </span>            :   const string&amp; full_name() const;   // Fully-qualified name of the field.
<span class="lineNum">     417 </span>            :   const FileDescriptor* file() const;// File in which this field was defined.
<span class="lineNum">     418 </span>            :   bool is_extension() const;         // Is this an extension field?
<span class="lineNum">     419 </span>            :   int number() const;                // Declared tag number.
<span class="lineNum">     420 </span>            : 
<span class="lineNum">     421 </span>            :   // Same as name() except converted to lower-case.  This (and especially the
<span class="lineNum">     422 </span>            :   // FindFieldByLowercaseName() method) can be useful when parsing formats
<span class="lineNum">     423 </span>            :   // which prefer to use lowercase naming style.  (Although, technically
<span class="lineNum">     424 </span>            :   // field names should be lowercased anyway according to the protobuf style
<span class="lineNum">     425 </span>            :   // guide, so this only makes a difference when dealing with old .proto files
<span class="lineNum">     426 </span>            :   // which do not follow the guide.)
<span class="lineNum">     427 </span>            :   const string&amp; lowercase_name() const;
<span class="lineNum">     428 </span>            : 
<span class="lineNum">     429 </span>            :   // Same as name() except converted to camel-case.  In this conversion, any
<span class="lineNum">     430 </span>            :   // time an underscore appears in the name, it is removed and the next
<span class="lineNum">     431 </span>            :   // letter is capitalized.  Furthermore, the first letter of the name is
<span class="lineNum">     432 </span>            :   // lower-cased.  Examples:
<span class="lineNum">     433 </span>            :   //   FooBar -&gt; fooBar
<span class="lineNum">     434 </span>            :   //   foo_bar -&gt; fooBar
<span class="lineNum">     435 </span>            :   //   fooBar -&gt; fooBar
<span class="lineNum">     436 </span>            :   // This (and especially the FindFieldByCamelcaseName() method) can be useful
<span class="lineNum">     437 </span>            :   // when parsing formats which prefer to use camel-case naming style.
<span class="lineNum">     438 </span>            :   const string&amp; camelcase_name() const;
<span class="lineNum">     439 </span>            : 
<span class="lineNum">     440 </span>            :   Type type() const;                  // Declared type of this field.
<span class="lineNum">     441 </span>            :   const char* type_name() const;      // Name of the declared type.
<span class="lineNum">     442 </span>            :   CppType cpp_type() const;           // C++ type of this field.
<span class="lineNum">     443 </span>            :   const char* cpp_type_name() const;  // Name of the C++ type.
<span class="lineNum">     444 </span>            :   Label label() const;                // optional/required/repeated
<span class="lineNum">     445 </span>            : 
<span class="lineNum">     446 </span>            :   bool is_required() const;      // shorthand for label() == LABEL_REQUIRED
<span class="lineNum">     447 </span>            :   bool is_optional() const;      // shorthand for label() == LABEL_OPTIONAL
<span class="lineNum">     448 </span>            :   bool is_repeated() const;      // shorthand for label() == LABEL_REPEATED
<span class="lineNum">     449 </span>            :   bool is_packable() const;      // shorthand for is_repeated() &amp;&amp;
<span class="lineNum">     450 </span>            :                                  //               IsTypePackable(type())
<span class="lineNum">     451 </span>            :   bool is_packed() const;        // shorthand for is_packable() &amp;&amp;
<span class="lineNum">     452 </span>            :                                  //               options().packed()
<span class="lineNum">     453 </span>            : 
<span class="lineNum">     454 </span>            :   // Index of this field within the message's field array, or the file or
<span class="lineNum">     455 </span>            :   // extension scope's extensions array.
<span class="lineNum">     456 </span>            :   int index() const;
<span class="lineNum">     457 </span>            : 
<span class="lineNum">     458 </span>            :   // Does this field have an explicitly-declared default value?
<span class="lineNum">     459 </span>            :   bool has_default_value() const;
<span class="lineNum">     460 </span>            : 
<span class="lineNum">     461 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_INT32.  If no
<span class="lineNum">     462 </span>            :   // explicit default was defined, the default is 0.
<span class="lineNum">     463 </span>            :   int32 default_value_int32() const;
<span class="lineNum">     464 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_INT64.  If no
<span class="lineNum">     465 </span>            :   // explicit default was defined, the default is 0.
<span class="lineNum">     466 </span>            :   int64 default_value_int64() const;
<span class="lineNum">     467 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_UINT32.  If no
<span class="lineNum">     468 </span>            :   // explicit default was defined, the default is 0.
<span class="lineNum">     469 </span>            :   uint32 default_value_uint32() const;
<span class="lineNum">     470 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_UINT64.  If no
<span class="lineNum">     471 </span>            :   // explicit default was defined, the default is 0.
<span class="lineNum">     472 </span>            :   uint64 default_value_uint64() const;
<span class="lineNum">     473 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_FLOAT.  If no
<span class="lineNum">     474 </span>            :   // explicit default was defined, the default is 0.0.
<span class="lineNum">     475 </span>            :   float default_value_float() const;
<span class="lineNum">     476 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_DOUBLE.  If no
<span class="lineNum">     477 </span>            :   // explicit default was defined, the default is 0.0.
<span class="lineNum">     478 </span>            :   double default_value_double() const;
<span class="lineNum">     479 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_BOOL.  If no
<span class="lineNum">     480 </span>            :   // explicit default was defined, the default is false.
<span class="lineNum">     481 </span>            :   bool default_value_bool() const;
<span class="lineNum">     482 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_ENUM.  If no
<span class="lineNum">     483 </span>            :   // explicit default was defined, the default is the first value defined
<span class="lineNum">     484 </span>            :   // in the enum type (all enum types are required to have at least one value).
<span class="lineNum">     485 </span>            :   // This never returns NULL.
<span class="lineNum">     486 </span>            :   const EnumValueDescriptor* default_value_enum() const;
<span class="lineNum">     487 </span>            :   // Get the field default value if cpp_type() == CPPTYPE_STRING.  If no
<span class="lineNum">     488 </span>            :   // explicit default was defined, the default is the empty string.
<span class="lineNum">     489 </span>            :   const string&amp; default_value_string() const;
<span class="lineNum">     490 </span>            : 
<span class="lineNum">     491 </span>            :   // The Descriptor for the message of which this is a field.  For extensions,
<span class="lineNum">     492 </span>            :   // this is the extended type.  Never NULL.
<span class="lineNum">     493 </span>            :   const Descriptor* containing_type() const;
<span class="lineNum">     494 </span>            : 
<span class="lineNum">     495 </span>            :   // If the field is a member of a oneof, this is the one, otherwise this is
<span class="lineNum">     496 </span>            :   // NULL.
<span class="lineNum">     497 </span>            :   const OneofDescriptor* containing_oneof() const;
<span class="lineNum">     498 </span>            : 
<span class="lineNum">     499 </span>            :   // If the field is a member of a oneof, returns the index in that oneof.
<span class="lineNum">     500 </span>            :   int index_in_oneof() const;
<span class="lineNum">     501 </span>            : 
<span class="lineNum">     502 </span>            :   // An extension may be declared within the scope of another message.  If this
<span class="lineNum">     503 </span>            :   // field is an extension (is_extension() is true), then extension_scope()
<span class="lineNum">     504 </span>            :   // returns that message, or NULL if the extension was declared at global
<span class="lineNum">     505 </span>            :   // scope.  If this is not an extension, extension_scope() is undefined (may
<span class="lineNum">     506 </span>            :   // assert-fail).
<span class="lineNum">     507 </span>            :   const Descriptor* extension_scope() const;
<span class="lineNum">     508 </span>            : 
<span class="lineNum">     509 </span>            :   // If type is TYPE_MESSAGE or TYPE_GROUP, returns a descriptor for the
<span class="lineNum">     510 </span>            :   // message or the group type.  Otherwise, returns null.
<span class="lineNum">     511 </span>            :   const Descriptor* message_type() const;
<span class="lineNum">     512 </span>            :   // If type is TYPE_ENUM, returns a descriptor for the enum.  Otherwise,
<span class="lineNum">     513 </span>            :   // returns null.
<span class="lineNum">     514 </span>            :   const EnumDescriptor* enum_type() const;
<span class="lineNum">     515 </span>            : 
<span class="lineNum">     516 </span>            :   // EXPERIMENTAL; DO NOT USE.
<span class="lineNum">     517 </span>            :   // If this field is a map field, experimental_map_key() is the field
<span class="lineNum">     518 </span>            :   // that is the key for this map.
<span class="lineNum">     519 </span>            :   // experimental_map_key()-&gt;containing_type() is the same as message_type().
<span class="lineNum">     520 </span>            :   const FieldDescriptor* experimental_map_key() const;
<span class="lineNum">     521 </span>            : 
<span class="lineNum">     522 </span>            :   // Get the FieldOptions for this field.  This includes things listed in
<span class="lineNum">     523 </span>            :   // square brackets after the field definition.  E.g., the field:
<span class="lineNum">     524 </span>            :   //   optional string text = 1 [ctype=CORD];
<span class="lineNum">     525 </span>            :   // has the &quot;ctype&quot; option set.  Allowed options are defined by FieldOptions
<span class="lineNum">     526 </span>            :   // in google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">     527 </span>            :   // message.
<span class="lineNum">     528 </span>            :   const FieldOptions&amp; options() const;
<span class="lineNum">     529 </span>            : 
<span class="lineNum">     530 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     531 </span>            :   void CopyTo(FieldDescriptorProto* proto) const;
<span class="lineNum">     532 </span>            : 
<span class="lineNum">     533 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     534 </span>            :   string DebugString() const;
<span class="lineNum">     535 </span>            : 
<span class="lineNum">     536 </span>            :   // Helper method to get the CppType for a particular Type.
<span class="lineNum">     537 </span>            :   static CppType TypeToCppType(Type type);
<span class="lineNum">     538 </span>            : 
<span class="lineNum">     539 </span>            :   // Helper method to get the name of a Type.
<span class="lineNum">     540 </span>            :   static const char* TypeName(Type type);
<span class="lineNum">     541 </span>            : 
<span class="lineNum">     542 </span>            :   // Helper method to get the name of a CppType.
<span class="lineNum">     543 </span>            :   static const char* CppTypeName(CppType cpp_type);
<span class="lineNum">     544 </span>            : 
<span class="lineNum">     545 </span>            :   // Return true iff [packed = true] is valid for fields of this type.
<span class="lineNum">     546 </span>            :   static inline bool IsTypePackable(Type field_type);
<span class="lineNum">     547 </span>            : 
<span class="lineNum">     548 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     549 </span>            : 
<span class="lineNum">     550 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     551 </span>            :   // extent of this field declaration.  Returns false and leaves
<span class="lineNum">     552 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     553 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     554 </span>            : 
<span class="lineNum">     555 </span>            :  private:
<span class="lineNum">     556 </span>            :   typedef FieldOptions OptionsType;
<span class="lineNum">     557 </span>            : 
<span class="lineNum">     558 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     559 </span>            :   enum PrintLabelFlag { PRINT_LABEL, OMIT_LABEL };
<span class="lineNum">     560 </span>            :   void DebugString(int depth, PrintLabelFlag print_label_flag,
<span class="lineNum">     561 </span>            :                    string* contents) const;
<span class="lineNum">     562 </span>            : 
<span class="lineNum">     563 </span>            :   // formats the default value appropriately and returns it as a string.
<span class="lineNum">     564 </span>            :   // Must have a default value to call this. If quote_string_type is true, then
<span class="lineNum">     565 </span>            :   // types of CPPTYPE_STRING whill be surrounded by quotes and CEscaped.
<span class="lineNum">     566 </span>            :   string DefaultValueAsString(bool quote_string_type) const;
<span class="lineNum">     567 </span>            : 
<span class="lineNum">     568 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     569 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     570 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     571 </span>            : 
<span class="lineNum">     572 </span>            :   const string* name_;
<span class="lineNum">     573 </span>            :   const string* full_name_;
<span class="lineNum">     574 </span>            :   const string* lowercase_name_;
<span class="lineNum">     575 </span>            :   const string* camelcase_name_;
<span class="lineNum">     576 </span>            :   const FileDescriptor* file_;
<span class="lineNum">     577 </span>            :   int number_;
<span class="lineNum">     578 </span>            :   Type type_;
<span class="lineNum">     579 </span>            :   Label label_;
<span class="lineNum">     580 </span>            :   bool is_extension_;
<span class="lineNum">     581 </span>            :   int index_in_oneof_;
<span class="lineNum">     582 </span>            :   const Descriptor* containing_type_;
<span class="lineNum">     583 </span>            :   const OneofDescriptor* containing_oneof_;
<span class="lineNum">     584 </span>            :   const Descriptor* extension_scope_;
<span class="lineNum">     585 </span>            :   const Descriptor* message_type_;
<span class="lineNum">     586 </span>            :   const EnumDescriptor* enum_type_;
<span class="lineNum">     587 </span>            :   const FieldDescriptor* experimental_map_key_;
<span class="lineNum">     588 </span>            :   const FieldOptions* options_;
<span class="lineNum">     589 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     590 </span>            :   // of Allocate&lt;FieldDescriptor&gt;() and AllocateArray&lt;FieldDescriptor&gt;() in
<span class="lineNum">     591 </span>            :   // descriptor.cc and update them to initialize the field.
<span class="lineNum">     592 </span>            : 
<span class="lineNum">     593 </span>            :   bool has_default_value_;
<span class="lineNum">     594 </span>            :   union {
<span class="lineNum">     595 </span>            :     int32  default_value_int32_;
<span class="lineNum">     596 </span>            :     int64  default_value_int64_;
<span class="lineNum">     597 </span>            :     uint32 default_value_uint32_;
<span class="lineNum">     598 </span>            :     uint64 default_value_uint64_;
<span class="lineNum">     599 </span>            :     float  default_value_float_;
<span class="lineNum">     600 </span>            :     double default_value_double_;
<span class="lineNum">     601 </span>            :     bool   default_value_bool_;
<span class="lineNum">     602 </span>            : 
<span class="lineNum">     603 </span>            :     const EnumValueDescriptor* default_value_enum_;
<span class="lineNum">     604 </span>            :     const string* default_value_string_;
<span class="lineNum">     605 </span>            :   };
<span class="lineNum">     606 </span>            : 
<span class="lineNum">     607 </span>            :   static const CppType kTypeToCppTypeMap[MAX_TYPE + 1];
<span class="lineNum">     608 </span>            : 
<span class="lineNum">     609 </span>            :   static const char * const kTypeToName[MAX_TYPE + 1];
<span class="lineNum">     610 </span>            : 
<span class="lineNum">     611 </span>            :   static const char * const kCppTypeToName[MAX_CPPTYPE + 1];
<span class="lineNum">     612 </span>            : 
<span class="lineNum">     613 </span>            :   static const char * const kLabelToName[MAX_LABEL + 1];
<span class="lineNum">     614 </span>            : 
<span class="lineNum">     615 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     616 </span>            :   FieldDescriptor() {}
<span class="lineNum">     617 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     618 </span>            :   friend class FileDescriptor;
<span class="lineNum">     619 </span>            :   friend class Descriptor;
<span class="lineNum">     620 </span>            :   friend class OneofDescriptor;
<span class="lineNum">     621 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldDescriptor);
<span class="lineNum">     622 </span>            : };
<span class="lineNum">     623 </span>            : 
<span class="lineNum">     624 </span>            : // Describes a oneof defined in a message type.
<span class="lineNum">     625 </span>            : class LIBPROTOBUF_EXPORT OneofDescriptor {
<span class="lineNum">     626 </span>            :  public:
<span class="lineNum">     627 </span>            :   const string&amp; name() const;       // Name of this oneof.
<span class="lineNum">     628 </span>            :   const string&amp; full_name() const;  // Fully-qualified name of the oneof.
<span class="lineNum">     629 </span>            : 
<span class="lineNum">     630 </span>            :   // Index of this oneof within the message's oneof array.
<span class="lineNum">     631 </span>            :   int index() const;
<span class="lineNum">     632 </span>            : 
<span class="lineNum">     633 </span>            :   // The Descriptor for the message containing this oneof.
<span class="lineNum">     634 </span>            :   const Descriptor* containing_type() const;
<span class="lineNum">     635 </span>            : 
<span class="lineNum">     636 </span>            :   // The number of (non-extension) fields which are members of this oneof.
<span class="lineNum">     637 </span>            :   int field_count() const;
<span class="lineNum">     638 </span>            :   // Get a member of this oneof, in the order in which they were declared in the
<span class="lineNum">     639 </span>            :   // .proto file.  Does not include extensions.
<span class="lineNum">     640 </span>            :   const FieldDescriptor* field(int index) const;
<span class="lineNum">     641 </span>            : 
<span class="lineNum">     642 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     643 </span>            :   void CopyTo(OneofDescriptorProto* proto) const;
<span class="lineNum">     644 </span>            : 
<span class="lineNum">     645 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     646 </span>            :   string DebugString() const;
<span class="lineNum">     647 </span>            : 
<span class="lineNum">     648 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     649 </span>            : 
<span class="lineNum">     650 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     651 </span>            :   // extent of this oneof declaration.  Returns false and leaves
<span class="lineNum">     652 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     653 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     654 </span>            : 
<span class="lineNum">     655 </span>            :  private:
<span class="lineNum">     656 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     657 </span>            :   void DebugString(int depth, string* contents) const;
<span class="lineNum">     658 </span>            : 
<span class="lineNum">     659 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     660 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     661 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     662 </span>            : 
<span class="lineNum">     663 </span>            :   const string* name_;
<span class="lineNum">     664 </span>            :   const string* full_name_;
<span class="lineNum">     665 </span>            :   const Descriptor* containing_type_;
<span class="lineNum">     666 </span>            :   bool is_extendable_;
<span class="lineNum">     667 </span>            :   int field_count_;
<span class="lineNum">     668 </span>            :   const FieldDescriptor** fields_;
<span class="lineNum">     669 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     670 </span>            :   // of Allocate&lt;OneofDescriptor&gt;() and AllocateArray&lt;OneofDescriptor&gt;()
<span class="lineNum">     671 </span>            :   // in descriptor.cc and update them to initialize the field.
<span class="lineNum">     672 </span>            : 
<span class="lineNum">     673 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     674 </span>            :   OneofDescriptor() {}
<span class="lineNum">     675 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     676 </span>            :   friend class Descriptor;
<span class="lineNum">     677 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofDescriptor);
<span class="lineNum">     678 </span>            : };
<span class="lineNum">     679 </span>            : 
<span class="lineNum">     680 </span>            : // Describes an enum type defined in a .proto file.  To get the EnumDescriptor
<span class="lineNum">     681 </span>            : // for a generated enum type, call TypeName_descriptor().  Use DescriptorPool
<span class="lineNum">     682 </span>            : // to construct your own descriptors.
<span class="lineNum">     683 </span>            : class LIBPROTOBUF_EXPORT EnumDescriptor {
<span class="lineNum">     684 </span>            :  public:
<span class="lineNum">     685 </span>            :   // The name of this enum type in the containing scope.
<span class="lineNum">     686 </span>            :   const string&amp; name() const;
<span class="lineNum">     687 </span>            : 
<span class="lineNum">     688 </span>            :   // The fully-qualified name of the enum type, scope delimited by periods.
<span class="lineNum">     689 </span>            :   const string&amp; full_name() const;
<span class="lineNum">     690 </span>            : 
<span class="lineNum">     691 </span>            :   // Index of this enum within the file or containing message's enum array.
<span class="lineNum">     692 </span>            :   int index() const;
<span class="lineNum">     693 </span>            : 
<span class="lineNum">     694 </span>            :   // The .proto file in which this enum type was defined.  Never NULL.
<span class="lineNum">     695 </span>            :   const FileDescriptor* file() const;
<span class="lineNum">     696 </span>            : 
<span class="lineNum">     697 </span>            :   // The number of values for this EnumDescriptor.  Guaranteed to be greater
<span class="lineNum">     698 </span>            :   // than zero.
<span class="lineNum">     699 </span>            :   int value_count() const;
<span class="lineNum">     700 </span>            :   // Gets a value by index, where 0 &lt;= index &lt; value_count().
<span class="lineNum">     701 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     702 </span>            :   const EnumValueDescriptor* value(int index) const;
<span class="lineNum">     703 </span>            : 
<span class="lineNum">     704 </span>            :   // Looks up a value by name.  Returns NULL if no such value exists.
<span class="lineNum">     705 </span>            :   const EnumValueDescriptor* FindValueByName(const string&amp; name) const;
<span class="lineNum">     706 </span>            :   // Looks up a value by number.  Returns NULL if no such value exists.  If
<span class="lineNum">     707 </span>            :   // multiple values have this number, the first one defined is returned.
<span class="lineNum">     708 </span>            :   const EnumValueDescriptor* FindValueByNumber(int number) const;
<span class="lineNum">     709 </span>            : 
<span class="lineNum">     710 </span>            :   // If this enum type is nested in a message type, this is that message type.
<span class="lineNum">     711 </span>            :   // Otherwise, NULL.
<span class="lineNum">     712 </span>            :   const Descriptor* containing_type() const;
<span class="lineNum">     713 </span>            : 
<span class="lineNum">     714 </span>            :   // Get options for this enum type.  These are specified in the .proto file by
<span class="lineNum">     715 </span>            :   // placing lines like &quot;option foo = 1234;&quot; in the enum definition.  Allowed
<span class="lineNum">     716 </span>            :   // options are defined by EnumOptions in google/protobuf/descriptor.proto,
<span class="lineNum">     717 </span>            :   // and any available extensions of that message.
<span class="lineNum">     718 </span>            :   const EnumOptions&amp; options() const;
<span class="lineNum">     719 </span>            : 
<span class="lineNum">     720 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     721 </span>            :   void CopyTo(EnumDescriptorProto* proto) const;
<span class="lineNum">     722 </span>            : 
<span class="lineNum">     723 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     724 </span>            :   string DebugString() const;
<span class="lineNum">     725 </span>            : 
<span class="lineNum">     726 </span>            :   // Returns true if this is a placeholder for an unknown enum. This will
<span class="lineNum">     727 </span>            :   // only be the case if this descriptor comes from a DescriptorPool
<span class="lineNum">     728 </span>            :   // with AllowUnknownDependencies() set.
<span class="lineNum">     729 </span>            :   bool is_placeholder() const;
<span class="lineNum">     730 </span>            : 
<span class="lineNum">     731 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     732 </span>            : 
<span class="lineNum">     733 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     734 </span>            :   // extent of this enum declaration.  Returns false and leaves
<span class="lineNum">     735 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     736 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     737 </span>            : 
<span class="lineNum">     738 </span>            :  private:
<span class="lineNum">     739 </span>            :   typedef EnumOptions OptionsType;
<span class="lineNum">     740 </span>            : 
<span class="lineNum">     741 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     742 </span>            :   void DebugString(int depth, string *contents) const;
<span class="lineNum">     743 </span>            : 
<span class="lineNum">     744 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     745 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     746 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     747 </span>            : 
<span class="lineNum">     748 </span>            :   const string* name_;
<span class="lineNum">     749 </span>            :   const string* full_name_;
<span class="lineNum">     750 </span>            :   const FileDescriptor* file_;
<span class="lineNum">     751 </span>            :   const Descriptor* containing_type_;
<span class="lineNum">     752 </span>            :   const EnumOptions* options_;
<span class="lineNum">     753 </span>            : 
<span class="lineNum">     754 </span>            :   // True if this is a placeholder for an unknown type.
<span class="lineNum">     755 </span>            :   bool is_placeholder_;
<span class="lineNum">     756 </span>            :   // True if this is a placeholder and the type name wasn't fully-qualified.
<span class="lineNum">     757 </span>            :   bool is_unqualified_placeholder_;
<span class="lineNum">     758 </span>            : 
<span class="lineNum">     759 </span>            :   int value_count_;
<span class="lineNum">     760 </span>            :   EnumValueDescriptor* values_;
<span class="lineNum">     761 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     762 </span>            :   // of Allocate&lt;EnumDescriptor&gt;() and AllocateArray&lt;EnumDescriptor&gt;() in
<span class="lineNum">     763 </span>            :   // descriptor.cc and update them to initialize the field.
<span class="lineNum">     764 </span>            : 
<span class="lineNum">     765 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     766 </span>            :   EnumDescriptor() {}
<span class="lineNum">     767 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     768 </span>            :   friend class Descriptor;
<span class="lineNum">     769 </span>            :   friend class FieldDescriptor;
<span class="lineNum">     770 </span>            :   friend class EnumValueDescriptor;
<span class="lineNum">     771 </span>            :   friend class FileDescriptor;
<span class="lineNum">     772 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumDescriptor);
<span class="lineNum">     773 </span>            : };
<span class="lineNum">     774 </span>            : 
<span class="lineNum">     775 </span>            : // Describes an individual enum constant of a particular type.  To get the
<span class="lineNum">     776 </span>            : // EnumValueDescriptor for a given enum value, first get the EnumDescriptor
<span class="lineNum">     777 </span>            : // for its type, then use EnumDescriptor::FindValueByName() or
<span class="lineNum">     778 </span>            : // EnumDescriptor::FindValueByNumber().  Use DescriptorPool to construct
<span class="lineNum">     779 </span>            : // your own descriptors.
<span class="lineNum">     780 </span>            : class LIBPROTOBUF_EXPORT EnumValueDescriptor {
<span class="lineNum">     781 </span>            :  public:
<span class="lineNum">     782 </span>            :   const string&amp; name() const;  // Name of this enum constant.
<span class="lineNum">     783 </span>            :   int index() const;           // Index within the enums's Descriptor.
<span class="lineNum">     784 </span>            :   int number() const;          // Numeric value of this enum constant.
<span class="lineNum">     785 </span>            : 
<span class="lineNum">     786 </span>            :   // The full_name of an enum value is a sibling symbol of the enum type.
<span class="lineNum">     787 </span>            :   // e.g. the full name of FieldDescriptorProto::TYPE_INT32 is actually
<span class="lineNum">     788 </span>            :   // &quot;google.protobuf.FieldDescriptorProto.TYPE_INT32&quot;, NOT
<span class="lineNum">     789 </span>            :   // &quot;google.protobuf.FieldDescriptorProto.Type.TYPE_INT32&quot;.  This is to conform
<span class="lineNum">     790 </span>            :   // with C++ scoping rules for enums.
<span class="lineNum">     791 </span>            :   const string&amp; full_name() const;
<span class="lineNum">     792 </span>            : 
<span class="lineNum">     793 </span>            :   // The type of this value.  Never NULL.
<span class="lineNum">     794 </span>            :   const EnumDescriptor* type() const;
<span class="lineNum">     795 </span>            : 
<span class="lineNum">     796 </span>            :   // Get options for this enum value.  These are specified in the .proto file
<span class="lineNum">     797 </span>            :   // by adding text like &quot;[foo = 1234]&quot; after an enum value definition.
<span class="lineNum">     798 </span>            :   // Allowed options are defined by EnumValueOptions in
<span class="lineNum">     799 </span>            :   // google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">     800 </span>            :   // message.
<span class="lineNum">     801 </span>            :   const EnumValueOptions&amp; options() const;
<span class="lineNum">     802 </span>            : 
<span class="lineNum">     803 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     804 </span>            :   void CopyTo(EnumValueDescriptorProto* proto) const;
<span class="lineNum">     805 </span>            : 
<span class="lineNum">     806 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     807 </span>            :   string DebugString() const;
<span class="lineNum">     808 </span>            : 
<span class="lineNum">     809 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     810 </span>            : 
<span class="lineNum">     811 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     812 </span>            :   // extent of this enum value declaration.  Returns false and leaves
<span class="lineNum">     813 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     814 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     815 </span>            : 
<span class="lineNum">     816 </span>            :  private:
<span class="lineNum">     817 </span>            :   typedef EnumValueOptions OptionsType;
<span class="lineNum">     818 </span>            : 
<span class="lineNum">     819 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     820 </span>            :   void DebugString(int depth, string *contents) const;
<span class="lineNum">     821 </span>            : 
<span class="lineNum">     822 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     823 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     824 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     825 </span>            : 
<span class="lineNum">     826 </span>            :   const string* name_;
<span class="lineNum">     827 </span>            :   const string* full_name_;
<span class="lineNum">     828 </span>            :   int number_;
<span class="lineNum">     829 </span>            :   const EnumDescriptor* type_;
<span class="lineNum">     830 </span>            :   const EnumValueOptions* options_;
<span class="lineNum">     831 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     832 </span>            :   // of Allocate&lt;EnumValueDescriptor&gt;() and AllocateArray&lt;EnumValueDescriptor&gt;()
<span class="lineNum">     833 </span>            :   // in descriptor.cc and update them to initialize the field.
<span class="lineNum">     834 </span>            : 
<span class="lineNum">     835 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     836 </span>            :   EnumValueDescriptor() {}
<span class="lineNum">     837 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     838 </span>            :   friend class EnumDescriptor;
<span class="lineNum">     839 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumValueDescriptor);
<span class="lineNum">     840 </span>            : };
<span class="lineNum">     841 </span>            : 
<span class="lineNum">     842 </span>            : // Describes an RPC service.  To get the ServiceDescriptor for a service,
<span class="lineNum">     843 </span>            : // call Service::GetDescriptor().  Generated service classes also have a
<span class="lineNum">     844 </span>            : // static method called descriptor() which returns the type's
<span class="lineNum">     845 </span>            : // ServiceDescriptor.  Use DescriptorPool to construct your own descriptors.
<span class="lineNum">     846 </span>            : class LIBPROTOBUF_EXPORT ServiceDescriptor {
<span class="lineNum">     847 </span>            :  public:
<span class="lineNum">     848 </span>            :   // The name of the service, not including its containing scope.
<span class="lineNum">     849 </span>            :   const string&amp; name() const;
<span class="lineNum">     850 </span>            :   // The fully-qualified name of the service, scope delimited by periods.
<span class="lineNum">     851 </span>            :   const string&amp; full_name() const;
<span class="lineNum">     852 </span>            :   // Index of this service within the file's services array.
<span class="lineNum">     853 </span>            :   int index() const;
<span class="lineNum">     854 </span>            : 
<span class="lineNum">     855 </span>            :   // The .proto file in which this service was defined.  Never NULL.
<span class="lineNum">     856 </span>            :   const FileDescriptor* file() const;
<span class="lineNum">     857 </span>            : 
<span class="lineNum">     858 </span>            :   // Get options for this service type.  These are specified in the .proto file
<span class="lineNum">     859 </span>            :   // by placing lines like &quot;option foo = 1234;&quot; in the service definition.
<span class="lineNum">     860 </span>            :   // Allowed options are defined by ServiceOptions in
<span class="lineNum">     861 </span>            :   // google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">     862 </span>            :   // message.
<span class="lineNum">     863 </span>            :   const ServiceOptions&amp; options() const;
<span class="lineNum">     864 </span>            : 
<span class="lineNum">     865 </span>            :   // The number of methods this service defines.
<span class="lineNum">     866 </span>            :   int method_count() const;
<span class="lineNum">     867 </span>            :   // Gets a MethodDescriptor by index, where 0 &lt;= index &lt; method_count().
<span class="lineNum">     868 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">     869 </span>            :   const MethodDescriptor* method(int index) const;
<span class="lineNum">     870 </span>            : 
<span class="lineNum">     871 </span>            :   // Look up a MethodDescriptor by name.
<span class="lineNum">     872 </span>            :   const MethodDescriptor* FindMethodByName(const string&amp; name) const;
<span class="lineNum">     873 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     874 </span>            :   void CopyTo(ServiceDescriptorProto* proto) const;
<span class="lineNum">     875 </span>            : 
<span class="lineNum">     876 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     877 </span>            :   string DebugString() const;
<span class="lineNum">     878 </span>            : 
<span class="lineNum">     879 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     880 </span>            : 
<span class="lineNum">     881 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     882 </span>            :   // extent of this service declaration.  Returns false and leaves
<span class="lineNum">     883 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     884 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     885 </span>            : 
<span class="lineNum">     886 </span>            :  private:
<span class="lineNum">     887 </span>            :   typedef ServiceOptions OptionsType;
<span class="lineNum">     888 </span>            : 
<span class="lineNum">     889 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     890 </span>            :   void DebugString(string *contents) const;
<span class="lineNum">     891 </span>            : 
<span class="lineNum">     892 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     893 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     894 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     895 </span>            : 
<span class="lineNum">     896 </span>            :   const string* name_;
<span class="lineNum">     897 </span>            :   const string* full_name_;
<span class="lineNum">     898 </span>            :   const FileDescriptor* file_;
<span class="lineNum">     899 </span>            :   const ServiceOptions* options_;
<span class="lineNum">     900 </span>            :   int method_count_;
<span class="lineNum">     901 </span>            :   MethodDescriptor* methods_;
<span class="lineNum">     902 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     903 </span>            :   // of Allocate&lt;ServiceDescriptor&gt;() and AllocateArray&lt;ServiceDescriptor&gt;() in
<span class="lineNum">     904 </span>            :   // descriptor.cc and update them to initialize the field.
<span class="lineNum">     905 </span>            : 
<span class="lineNum">     906 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     907 </span>            :   ServiceDescriptor() {}
<span class="lineNum">     908 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     909 </span>            :   friend class FileDescriptor;
<span class="lineNum">     910 </span>            :   friend class MethodDescriptor;
<span class="lineNum">     911 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceDescriptor);
<span class="lineNum">     912 </span>            : };
<span class="lineNum">     913 </span>            : 
<span class="lineNum">     914 </span>            : // Describes an individual service method.  To obtain a MethodDescriptor given
<span class="lineNum">     915 </span>            : // a service, first get its ServiceDescriptor, then call
<span class="lineNum">     916 </span>            : // ServiceDescriptor::FindMethodByName().  Use DescriptorPool to construct your
<span class="lineNum">     917 </span>            : // own descriptors.
<span class="lineNum">     918 </span>            : class LIBPROTOBUF_EXPORT MethodDescriptor {
<span class="lineNum">     919 </span>            :  public:
<span class="lineNum">     920 </span>            :   // Name of this method, not including containing scope.
<span class="lineNum">     921 </span>            :   const string&amp; name() const;
<span class="lineNum">     922 </span>            :   // The fully-qualified name of the method, scope delimited by periods.
<span class="lineNum">     923 </span>            :   const string&amp; full_name() const;
<span class="lineNum">     924 </span>            :   // Index within the service's Descriptor.
<span class="lineNum">     925 </span>            :   int index() const;
<span class="lineNum">     926 </span>            : 
<span class="lineNum">     927 </span>            :   // Gets the service to which this method belongs.  Never NULL.
<span class="lineNum">     928 </span>            :   const ServiceDescriptor* service() const;
<span class="lineNum">     929 </span>            : 
<span class="lineNum">     930 </span>            :   // Gets the type of protocol message which this method accepts as input.
<span class="lineNum">     931 </span>            :   const Descriptor* input_type() const;
<span class="lineNum">     932 </span>            :   // Gets the type of protocol message which this message produces as output.
<span class="lineNum">     933 </span>            :   const Descriptor* output_type() const;
<span class="lineNum">     934 </span>            : 
<span class="lineNum">     935 </span>            :   // Get options for this method.  These are specified in the .proto file by
<span class="lineNum">     936 </span>            :   // placing lines like &quot;option foo = 1234;&quot; in curly-braces after a method
<span class="lineNum">     937 </span>            :   // declaration.  Allowed options are defined by MethodOptions in
<span class="lineNum">     938 </span>            :   // google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">     939 </span>            :   // message.
<span class="lineNum">     940 </span>            :   const MethodOptions&amp; options() const;
<span class="lineNum">     941 </span>            : 
<span class="lineNum">     942 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">     943 </span>            :   void CopyTo(MethodDescriptorProto* proto) const;
<span class="lineNum">     944 </span>            : 
<span class="lineNum">     945 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     946 </span>            :   string DebugString() const;
<span class="lineNum">     947 </span>            : 
<span class="lineNum">     948 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">     949 </span>            : 
<span class="lineNum">     950 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">     951 </span>            :   // extent of this method declaration.  Returns false and leaves
<span class="lineNum">     952 </span>            :   // |*out_location| unchanged iff location information was not available.
<span class="lineNum">     953 </span>            :   bool GetSourceLocation(SourceLocation* out_location) const;
<span class="lineNum">     954 </span>            : 
<span class="lineNum">     955 </span>            :  private:
<span class="lineNum">     956 </span>            :   typedef MethodOptions OptionsType;
<span class="lineNum">     957 </span>            : 
<span class="lineNum">     958 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">     959 </span>            :   void DebugString(int depth, string *contents) const;
<span class="lineNum">     960 </span>            : 
<span class="lineNum">     961 </span>            :   // Walks up the descriptor tree to generate the source location path
<span class="lineNum">     962 </span>            :   // to this descriptor from the file root.
<span class="lineNum">     963 </span>            :   void GetLocationPath(vector&lt;int&gt;* output) const;
<span class="lineNum">     964 </span>            : 
<span class="lineNum">     965 </span>            :   const string* name_;
<span class="lineNum">     966 </span>            :   const string* full_name_;
<span class="lineNum">     967 </span>            :   const ServiceDescriptor* service_;
<span class="lineNum">     968 </span>            :   const Descriptor* input_type_;
<span class="lineNum">     969 </span>            :   const Descriptor* output_type_;
<span class="lineNum">     970 </span>            :   const MethodOptions* options_;
<span class="lineNum">     971 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">     972 </span>            :   // of Allocate&lt;MethodDescriptor&gt;() and AllocateArray&lt;MethodDescriptor&gt;() in
<span class="lineNum">     973 </span>            :   // descriptor.cc and update them to initialize the field.
<span class="lineNum">     974 </span>            : 
<span class="lineNum">     975 </span>            :   // Must be constructed using DescriptorPool.
<span class="lineNum">     976 </span>            :   MethodDescriptor() {}
<span class="lineNum">     977 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">     978 </span>            :   friend class ServiceDescriptor;
<span class="lineNum">     979 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MethodDescriptor);
<span class="lineNum">     980 </span>            : };
<span class="lineNum">     981 </span>            : 
<span class="lineNum">     982 </span>            : 
<span class="lineNum">     983 </span>            : // Describes a whole .proto file.  To get the FileDescriptor for a compiled-in
<span class="lineNum">     984 </span>            : // file, get the descriptor for something defined in that file and call
<span class="lineNum">     985 </span>            : // descriptor-&gt;file().  Use DescriptorPool to construct your own descriptors.
<span class="lineNum">     986 </span>            : class LIBPROTOBUF_EXPORT FileDescriptor {
<span class="lineNum">     987 </span>            :  public:
<span class="lineNum">     988 </span>            :   // The filename, relative to the source tree.
<span class="lineNum">     989 </span>            :   // e.g. &quot;google/protobuf/descriptor.proto&quot;
<span class="lineNum">     990 </span>            :   const string&amp; name() const;
<span class="lineNum">     991 </span>            : 
<span class="lineNum">     992 </span>            :   // The package, e.g. &quot;google.protobuf.compiler&quot;.
<span class="lineNum">     993 </span>            :   const string&amp; package() const;
<span class="lineNum">     994 </span>            : 
<span class="lineNum">     995 </span>            :   // The DescriptorPool in which this FileDescriptor and all its contents were
<span class="lineNum">     996 </span>            :   // allocated.  Never NULL.
<span class="lineNum">     997 </span>            :   const DescriptorPool* pool() const;
<span class="lineNum">     998 </span>            : 
<span class="lineNum">     999 </span>            :   // The number of files imported by this one.
<span class="lineNum">    1000 </span>            :   int dependency_count() const;
<span class="lineNum">    1001 </span>            :   // Gets an imported file by index, where 0 &lt;= index &lt; dependency_count().
<span class="lineNum">    1002 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1003 </span>            :   const FileDescriptor* dependency(int index) const;
<span class="lineNum">    1004 </span>            : 
<span class="lineNum">    1005 </span>            :   // The number of files public imported by this one.
<span class="lineNum">    1006 </span>            :   // The public dependency list is a subset of the dependency list.
<span class="lineNum">    1007 </span>            :   int public_dependency_count() const;
<span class="lineNum">    1008 </span>            :   // Gets a public imported file by index, where 0 &lt;= index &lt;
<span class="lineNum">    1009 </span>            :   // public_dependency_count().
<span class="lineNum">    1010 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1011 </span>            :   const FileDescriptor* public_dependency(int index) const;
<span class="lineNum">    1012 </span>            : 
<span class="lineNum">    1013 </span>            :   // The number of files that are imported for weak fields.
<span class="lineNum">    1014 </span>            :   // The weak dependency list is a subset of the dependency list.
<span class="lineNum">    1015 </span>            :   int weak_dependency_count() const;
<span class="lineNum">    1016 </span>            :   // Gets a weak imported file by index, where 0 &lt;= index &lt;
<span class="lineNum">    1017 </span>            :   // weak_dependency_count().
<span class="lineNum">    1018 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1019 </span>            :   const FileDescriptor* weak_dependency(int index) const;
<span class="lineNum">    1020 </span>            : 
<span class="lineNum">    1021 </span>            :   // Number of top-level message types defined in this file.  (This does not
<span class="lineNum">    1022 </span>            :   // include nested types.)
<span class="lineNum">    1023 </span>            :   int message_type_count() const;
<span class="lineNum">    1024 </span>            :   // Gets a top-level message type, where 0 &lt;= index &lt; message_type_count().
<span class="lineNum">    1025 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1026 </span>            :   const Descriptor* message_type(int index) const;
<span class="lineNum">    1027 </span>            : 
<span class="lineNum">    1028 </span>            :   // Number of top-level enum types defined in this file.  (This does not
<span class="lineNum">    1029 </span>            :   // include nested types.)
<span class="lineNum">    1030 </span>            :   int enum_type_count() const;
<span class="lineNum">    1031 </span>            :   // Gets a top-level enum type, where 0 &lt;= index &lt; enum_type_count().
<span class="lineNum">    1032 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1033 </span>            :   const EnumDescriptor* enum_type(int index) const;
<span class="lineNum">    1034 </span>            : 
<span class="lineNum">    1035 </span>            :   // Number of services defined in this file.
<span class="lineNum">    1036 </span>            :   int service_count() const;
<span class="lineNum">    1037 </span>            :   // Gets a service, where 0 &lt;= index &lt; service_count().
<span class="lineNum">    1038 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1039 </span>            :   const ServiceDescriptor* service(int index) const;
<span class="lineNum">    1040 </span>            : 
<span class="lineNum">    1041 </span>            :   // Number of extensions defined at file scope.  (This does not include
<span class="lineNum">    1042 </span>            :   // extensions nested within message types.)
<span class="lineNum">    1043 </span>            :   int extension_count() const;
<span class="lineNum">    1044 </span>            :   // Gets an extension's descriptor, where 0 &lt;= index &lt; extension_count().
<span class="lineNum">    1045 </span>            :   // These are returned in the order they were defined in the .proto file.
<span class="lineNum">    1046 </span>            :   const FieldDescriptor* extension(int index) const;
<span class="lineNum">    1047 </span>            : 
<span class="lineNum">    1048 </span>            :   // Get options for this file.  These are specified in the .proto file by
<span class="lineNum">    1049 </span>            :   // placing lines like &quot;option foo = 1234;&quot; at the top level, outside of any
<span class="lineNum">    1050 </span>            :   // other definitions.  Allowed options are defined by FileOptions in
<span class="lineNum">    1051 </span>            :   // google/protobuf/descriptor.proto, and any available extensions of that
<span class="lineNum">    1052 </span>            :   // message.
<span class="lineNum">    1053 </span>            :   const FileOptions&amp; options() const;
<span class="lineNum">    1054 </span>            : 
<span class="lineNum">    1055 </span>            :   // Find a top-level message type by name.  Returns NULL if not found.
<span class="lineNum">    1056 </span>            :   const Descriptor* FindMessageTypeByName(const string&amp; name) const;
<span class="lineNum">    1057 </span>            :   // Find a top-level enum type by name.  Returns NULL if not found.
<span class="lineNum">    1058 </span>            :   const EnumDescriptor* FindEnumTypeByName(const string&amp; name) const;
<span class="lineNum">    1059 </span>            :   // Find an enum value defined in any top-level enum by name.  Returns NULL if
<span class="lineNum">    1060 </span>            :   // not found.
<span class="lineNum">    1061 </span>            :   const EnumValueDescriptor* FindEnumValueByName(const string&amp; name) const;
<span class="lineNum">    1062 </span>            :   // Find a service definition by name.  Returns NULL if not found.
<span class="lineNum">    1063 </span>            :   const ServiceDescriptor* FindServiceByName(const string&amp; name) const;
<span class="lineNum">    1064 </span>            :   // Find a top-level extension definition by name.  Returns NULL if not found.
<span class="lineNum">    1065 </span>            :   const FieldDescriptor* FindExtensionByName(const string&amp; name) const;
<span class="lineNum">    1066 </span>            :   // Similar to FindExtensionByName(), but searches by lowercased-name.  See
<span class="lineNum">    1067 </span>            :   // Descriptor::FindFieldByLowercaseName().
<span class="lineNum">    1068 </span>            :   const FieldDescriptor* FindExtensionByLowercaseName(const string&amp; name) const;
<span class="lineNum">    1069 </span>            :   // Similar to FindExtensionByName(), but searches by camelcased-name.  See
<span class="lineNum">    1070 </span>            :   // Descriptor::FindFieldByCamelcaseName().
<span class="lineNum">    1071 </span>            :   const FieldDescriptor* FindExtensionByCamelcaseName(const string&amp; name) const;
<span class="lineNum">    1072 </span>            : 
<span class="lineNum">    1073 </span>            :   // See Descriptor::CopyTo().
<span class="lineNum">    1074 </span>            :   // Notes:
<span class="lineNum">    1075 </span>            :   // - This method does NOT copy source code information since it is relatively
<span class="lineNum">    1076 </span>            :   //   large and rarely needed.  See CopySourceCodeInfoTo() below.
<span class="lineNum">    1077 </span>            :   void CopyTo(FileDescriptorProto* proto) const;
<span class="lineNum">    1078 </span>            :   // Write the source code information of this FileDescriptor into the given
<span class="lineNum">    1079 </span>            :   // FileDescriptorProto.  See CopyTo() above.
<span class="lineNum">    1080 </span>            :   void CopySourceCodeInfoTo(FileDescriptorProto* proto) const;
<span class="lineNum">    1081 </span>            : 
<span class="lineNum">    1082 </span>            :   // See Descriptor::DebugString().
<span class="lineNum">    1083 </span>            :   string DebugString() const;
<span class="lineNum">    1084 </span>            : 
<span class="lineNum">    1085 </span>            :   // Returns true if this is a placeholder for an unknown file. This will
<span class="lineNum">    1086 </span>            :   // only be the case if this descriptor comes from a DescriptorPool
<span class="lineNum">    1087 </span>            :   // with AllowUnknownDependencies() set.
<span class="lineNum">    1088 </span>            :   bool is_placeholder() const;
<span class="lineNum">    1089 </span>            : 
<span class="lineNum">    1090 </span>            :  private:
<span class="lineNum">    1091 </span>            :   // Source Location ---------------------------------------------------
<span class="lineNum">    1092 </span>            : 
<span class="lineNum">    1093 </span>            :   // Updates |*out_location| to the source location of the complete
<span class="lineNum">    1094 </span>            :   // extent of the declaration or declaration-part denoted by |path|.
<span class="lineNum">    1095 </span>            :   // Returns false and leaves |*out_location| unchanged iff location
<span class="lineNum">    1096 </span>            :   // information was not available.  (See SourceCodeInfo for
<span class="lineNum">    1097 </span>            :   // description of path encoding.)
<span class="lineNum">    1098 </span>            :   bool GetSourceLocation(const vector&lt;int&gt;&amp; path,
<span class="lineNum">    1099 </span>            :                          SourceLocation* out_location) const;
<span class="lineNum">    1100 </span>            : 
<span class="lineNum">    1101 </span>            :   typedef FileOptions OptionsType;
<span class="lineNum">    1102 </span>            : 
<span class="lineNum">    1103 </span>            :   const string* name_;
<span class="lineNum">    1104 </span>            :   const string* package_;
<span class="lineNum">    1105 </span>            :   const DescriptorPool* pool_;
<span class="lineNum">    1106 </span>            :   int dependency_count_;
<span class="lineNum">    1107 </span>            :   const FileDescriptor** dependencies_;
<span class="lineNum">    1108 </span>            :   int public_dependency_count_;
<span class="lineNum">    1109 </span>            :   int* public_dependencies_;
<span class="lineNum">    1110 </span>            :   int weak_dependency_count_;
<span class="lineNum">    1111 </span>            :   int* weak_dependencies_;
<span class="lineNum">    1112 </span>            :   int message_type_count_;
<span class="lineNum">    1113 </span>            :   Descriptor* message_types_;
<span class="lineNum">    1114 </span>            :   int enum_type_count_;
<span class="lineNum">    1115 </span>            :   EnumDescriptor* enum_types_;
<span class="lineNum">    1116 </span>            :   int service_count_;
<span class="lineNum">    1117 </span>            :   ServiceDescriptor* services_;
<span class="lineNum">    1118 </span>            :   int extension_count_;
<span class="lineNum">    1119 </span>            :   bool is_placeholder_;
<span class="lineNum">    1120 </span>            :   FieldDescriptor* extensions_;
<span class="lineNum">    1121 </span>            :   const FileOptions* options_;
<span class="lineNum">    1122 </span>            : 
<span class="lineNum">    1123 </span>            :   const FileDescriptorTables* tables_;
<span class="lineNum">    1124 </span>            :   const SourceCodeInfo* source_code_info_;
<span class="lineNum">    1125 </span>            :   // IMPORTANT:  If you add a new field, make sure to search for all instances
<span class="lineNum">    1126 </span>            :   // of Allocate&lt;FileDescriptor&gt;() and AllocateArray&lt;FileDescriptor&gt;() in
<span class="lineNum">    1127 </span>            :   // descriptor.cc and update them to initialize the field.
<span class="lineNum">    1128 </span>            : 
<span class="lineNum">    1129 </span>            :   FileDescriptor() {}
<span class="lineNum">    1130 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">    1131 </span>            :   friend class Descriptor;
<span class="lineNum">    1132 </span>            :   friend class FieldDescriptor;
<span class="lineNum">    1133 </span>            :   friend class OneofDescriptor;
<span class="lineNum">    1134 </span>            :   friend class EnumDescriptor;
<span class="lineNum">    1135 </span>            :   friend class EnumValueDescriptor;
<span class="lineNum">    1136 </span>            :   friend class MethodDescriptor;
<span class="lineNum">    1137 </span>            :   friend class ServiceDescriptor;
<span class="lineNum">    1138 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileDescriptor);
<span class="lineNum">    1139 </span>            : };
<span class="lineNum">    1140 </span>            : 
<span class="lineNum">    1141 </span>            : // ===================================================================
<span class="lineNum">    1142 </span>            : 
<span class="lineNum">    1143 </span>            : // Used to construct descriptors.
<span class="lineNum">    1144 </span>            : //
<span class="lineNum">    1145 </span>            : // Normally you won't want to build your own descriptors.  Message classes
<span class="lineNum">    1146 </span>            : // constructed by the protocol compiler will provide them for you.  However,
<span class="lineNum">    1147 </span>            : // if you are implementing Message on your own, or if you are writing a
<span class="lineNum">    1148 </span>            : // program which can operate on totally arbitrary types and needs to load
<span class="lineNum">    1149 </span>            : // them from some sort of database, you might need to.
<span class="lineNum">    1150 </span>            : //
<span class="lineNum">    1151 </span>            : // Since Descriptors are composed of a whole lot of cross-linked bits of
<span class="lineNum">    1152 </span>            : // data that would be a pain to put together manually, the
<span class="lineNum">    1153 </span>            : // DescriptorPool class is provided to make the process easier.  It can
<span class="lineNum">    1154 </span>            : // take a FileDescriptorProto (defined in descriptor.proto), validate it,
<span class="lineNum">    1155 </span>            : // and convert it to a set of nicely cross-linked Descriptors.
<span class="lineNum">    1156 </span>            : //
<span class="lineNum">    1157 </span>            : // DescriptorPool also helps with memory management.  Descriptors are
<span class="lineNum">    1158 </span>            : // composed of many objects containing static data and pointers to each
<span class="lineNum">    1159 </span>            : // other.  In all likelihood, when it comes time to delete this data,
<span class="lineNum">    1160 </span>            : // you'll want to delete it all at once.  In fact, it is not uncommon to
<span class="lineNum">    1161 </span>            : // have a whole pool of descriptors all cross-linked with each other which
<span class="lineNum">    1162 </span>            : // you wish to delete all at once.  This class represents such a pool, and
<span class="lineNum">    1163 </span>            : // handles the memory management for you.
<span class="lineNum">    1164 </span>            : //
<span class="lineNum">    1165 </span>            : // You can also search for descriptors within a DescriptorPool by name, and
<span class="lineNum">    1166 </span>            : // extensions by number.
<span class="lineNum">    1167 </span>            : class LIBPROTOBUF_EXPORT DescriptorPool {
<span class="lineNum">    1168 </span>            :  public:
<span class="lineNum">    1169 </span>            :   // Create a normal, empty DescriptorPool.
<span class="lineNum">    1170 </span>            :   DescriptorPool();
<span class="lineNum">    1171 </span>            : 
<span class="lineNum">    1172 </span>            :   // Constructs a DescriptorPool that, when it can't find something among the
<span class="lineNum">    1173 </span>            :   // descriptors already in the pool, looks for it in the given
<span class="lineNum">    1174 </span>            :   // DescriptorDatabase.
<span class="lineNum">    1175 </span>            :   // Notes:
<span class="lineNum">    1176 </span>            :   // - If a DescriptorPool is constructed this way, its BuildFile*() methods
<span class="lineNum">    1177 </span>            :   //   must not be called (they will assert-fail).  The only way to populate
<span class="lineNum">    1178 </span>            :   //   the pool with descriptors is to call the Find*By*() methods.
<span class="lineNum">    1179 </span>            :   // - The Find*By*() methods may block the calling thread if the
<span class="lineNum">    1180 </span>            :   //   DescriptorDatabase blocks.  This in turn means that parsing messages
<span class="lineNum">    1181 </span>            :   //   may block if they need to look up extensions.
<span class="lineNum">    1182 </span>            :   // - The Find*By*() methods will use mutexes for thread-safety, thus making
<span class="lineNum">    1183 </span>            :   //   them slower even when they don't have to fall back to the database.
<span class="lineNum">    1184 </span>            :   //   In fact, even the Find*By*() methods of descriptor objects owned by
<span class="lineNum">    1185 </span>            :   //   this pool will be slower, since they will have to obtain locks too.
<span class="lineNum">    1186 </span>            :   // - An ErrorCollector may optionally be given to collect validation errors
<span class="lineNum">    1187 </span>            :   //   in files loaded from the database.  If not given, errors will be printed
<span class="lineNum">    1188 </span>            :   //   to GOOGLE_LOG(ERROR).  Remember that files are built on-demand, so this
<span class="lineNum">    1189 </span>            :   //   ErrorCollector may be called from any thread that calls one of the
<span class="lineNum">    1190 </span>            :   //   Find*By*() methods.
<span class="lineNum">    1191 </span>            :   // - The DescriptorDatabase must not be mutated during the lifetime of
<span class="lineNum">    1192 </span>            :   //   the DescriptorPool. Even if the client takes care to avoid data races,
<span class="lineNum">    1193 </span>            :   //   changes to the content of the DescriptorDatabase may not be reflected
<span class="lineNum">    1194 </span>            :   //   in subsequent lookups in the DescriptorPool.
<span class="lineNum">    1195 </span>            :   class ErrorCollector;
<span class="lineNum">    1196 </span>            :   explicit DescriptorPool(DescriptorDatabase* fallback_database,
<span class="lineNum">    1197 </span>            :                           ErrorCollector* error_collector = NULL);
<span class="lineNum">    1198 </span>            : 
<span class="lineNum">    1199 </span>            :   ~DescriptorPool();
<span class="lineNum">    1200 </span>            : 
<span class="lineNum">    1201 </span>            :   // Get a pointer to the generated pool.  Generated protocol message classes
<span class="lineNum">    1202 </span>            :   // which are compiled into the binary will allocate their descriptors in
<span class="lineNum">    1203 </span>            :   // this pool.  Do not add your own descriptors to this pool.
<span class="lineNum">    1204 </span>            :   static const DescriptorPool* generated_pool();
<span class="lineNum">    1205 </span>            : 
<span class="lineNum">    1206 </span>            :   // Find a FileDescriptor in the pool by file name.  Returns NULL if not
<span class="lineNum">    1207 </span>            :   // found.
<span class="lineNum">    1208 </span>            :   const FileDescriptor* FindFileByName(const string&amp; name) const;
<span class="lineNum">    1209 </span>            : 
<span class="lineNum">    1210 </span>            :   // Find the FileDescriptor in the pool which defines the given symbol.
<span class="lineNum">    1211 </span>            :   // If any of the Find*ByName() methods below would succeed, then this is
<span class="lineNum">    1212 </span>            :   // equivalent to calling that method and calling the result's file() method.
<span class="lineNum">    1213 </span>            :   // Otherwise this returns NULL.
<span class="lineNum">    1214 </span>            :   const FileDescriptor* FindFileContainingSymbol(
<span class="lineNum">    1215 </span>            :       const string&amp; symbol_name) const;
<span class="lineNum">    1216 </span>            : 
<span class="lineNum">    1217 </span>            :   // Looking up descriptors ------------------------------------------
<span class="lineNum">    1218 </span>            :   // These find descriptors by fully-qualified name.  These will find both
<span class="lineNum">    1219 </span>            :   // top-level descriptors and nested descriptors.  They return NULL if not
<span class="lineNum">    1220 </span>            :   // found.
<span class="lineNum">    1221 </span>            : 
<span class="lineNum">    1222 </span>            :   const Descriptor* FindMessageTypeByName(const string&amp; name) const;
<span class="lineNum">    1223 </span>            :   const FieldDescriptor* FindFieldByName(const string&amp; name) const;
<span class="lineNum">    1224 </span>            :   const FieldDescriptor* FindExtensionByName(const string&amp; name) const;
<span class="lineNum">    1225 </span>            :   const OneofDescriptor* FindOneofByName(const string&amp; name) const;
<span class="lineNum">    1226 </span>            :   const EnumDescriptor* FindEnumTypeByName(const string&amp; name) const;
<span class="lineNum">    1227 </span>            :   const EnumValueDescriptor* FindEnumValueByName(const string&amp; name) const;
<span class="lineNum">    1228 </span>            :   const ServiceDescriptor* FindServiceByName(const string&amp; name) const;
<span class="lineNum">    1229 </span>            :   const MethodDescriptor* FindMethodByName(const string&amp; name) const;
<span class="lineNum">    1230 </span>            : 
<span class="lineNum">    1231 </span>            :   // Finds an extension of the given type by number.  The extendee must be
<span class="lineNum">    1232 </span>            :   // a member of this DescriptorPool or one of its underlays.
<span class="lineNum">    1233 </span>            :   const FieldDescriptor* FindExtensionByNumber(const Descriptor* extendee,
<span class="lineNum">    1234 </span>            :                                                int number) const;
<span class="lineNum">    1235 </span>            : 
<span class="lineNum">    1236 </span>            :   // Finds extensions of extendee. The extensions will be appended to
<span class="lineNum">    1237 </span>            :   // out in an undefined order. Only extensions defined directly in
<span class="lineNum">    1238 </span>            :   // this DescriptorPool or one of its underlays are guaranteed to be
<span class="lineNum">    1239 </span>            :   // found: extensions defined in the fallback database might not be found
<span class="lineNum">    1240 </span>            :   // depending on the database implementation.
<span class="lineNum">    1241 </span>            :   void FindAllExtensions(const Descriptor* extendee,
<span class="lineNum">    1242 </span>            :                          vector&lt;const FieldDescriptor*&gt;* out) const;
<span class="lineNum">    1243 </span>            : 
<span class="lineNum">    1244 </span>            :   // Building descriptors --------------------------------------------
<span class="lineNum">    1245 </span>            : 
<span class="lineNum">    1246 </span>            :   // When converting a FileDescriptorProto to a FileDescriptor, various
<span class="lineNum">    1247 </span>            :   // errors might be detected in the input.  The caller may handle these
<span class="lineNum">    1248 </span>            :   // programmatically by implementing an ErrorCollector.
<span class="lineNum">    1249 </span>            :   class LIBPROTOBUF_EXPORT ErrorCollector {
<span class="lineNum">    1250 </span>            :    public:
<span class="lineNum">    1251 </span>            :     inline ErrorCollector() {}
<span class="lineNum">    1252 </span>            :     virtual ~ErrorCollector();
<span class="lineNum">    1253 </span>            : 
<span class="lineNum">    1254 </span>            :     // These constants specify what exact part of the construct is broken.
<span class="lineNum">    1255 </span>            :     // This is useful e.g. for mapping the error back to an exact location
<span class="lineNum">    1256 </span>            :     // in a .proto file.
<span class="lineNum">    1257 </span>            :     enum ErrorLocation {
<span class="lineNum">    1258 </span>            :       NAME,              // the symbol name, or the package name for files
<span class="lineNum">    1259 </span>            :       NUMBER,            // field or extension range number
<span class="lineNum">    1260 </span>            :       TYPE,              // field type
<span class="lineNum">    1261 </span>            :       EXTENDEE,          // field extendee
<span class="lineNum">    1262 </span>            :       DEFAULT_VALUE,     // field default value
<span class="lineNum">    1263 </span>            :       INPUT_TYPE,        // method input type
<span class="lineNum">    1264 </span>            :       OUTPUT_TYPE,       // method output type
<span class="lineNum">    1265 </span>            :       OPTION_NAME,       // name in assignment
<span class="lineNum">    1266 </span>            :       OPTION_VALUE,      // value in option assignment
<span class="lineNum">    1267 </span>            :       OTHER              // some other problem
<span class="lineNum">    1268 </span>            :     };
<span class="lineNum">    1269 </span>            : 
<span class="lineNum">    1270 </span>            :     // Reports an error in the FileDescriptorProto. Use this function if the
<span class="lineNum">    1271 </span>            :     // problem occured should interrupt building the FileDescriptorProto.
<span class="lineNum">    1272 </span>            :     virtual void AddError(
<span class="lineNum">    1273 </span>            :       const string&amp; filename,      // File name in which the error occurred.
<span class="lineNum">    1274 </span>            :       const string&amp; element_name,  // Full name of the erroneous element.
<span class="lineNum">    1275 </span>            :       const Message* descriptor,   // Descriptor of the erroneous element.
<span class="lineNum">    1276 </span>            :       ErrorLocation location,      // One of the location constants, above.
<span class="lineNum">    1277 </span>            :       const string&amp; message        // Human-readable error message.
<span class="lineNum">    1278 </span>            :       ) = 0;
<span class="lineNum">    1279 </span>            : 
<span class="lineNum">    1280 </span>            :     // Reports a warning in the FileDescriptorProto. Use this function if the
<span class="lineNum">    1281 </span>            :     // problem occured should NOT interrupt building the FileDescriptorProto.
<span class="lineNum">    1282 </span>            :     virtual void AddWarning(
<span class="lineNum">    1283 </span>            :       const string&amp; filename,      // File name in which the error occurred.
<span class="lineNum">    1284 </span>            :       const string&amp; element_name,  // Full name of the erroneous element.
<span class="lineNum">    1285 </span>            :       const Message* descriptor,   // Descriptor of the erroneous element.
<span class="lineNum">    1286 </span>            :       ErrorLocation location,      // One of the location constants, above.
<span class="lineNum">    1287 </span>            :       const string&amp; message        // Human-readable error message.
<span class="lineNum">    1288 </span>            :       ) {}
<span class="lineNum">    1289 </span>            : 
<span class="lineNum">    1290 </span>            :    private:
<span class="lineNum">    1291 </span>            :     GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector);
<span class="lineNum">    1292 </span>            :   };
<span class="lineNum">    1293 </span>            : 
<span class="lineNum">    1294 </span>            :   // Convert the FileDescriptorProto to real descriptors and place them in
<span class="lineNum">    1295 </span>            :   // this DescriptorPool.  All dependencies of the file must already be in
<span class="lineNum">    1296 </span>            :   // the pool.  Returns the resulting FileDescriptor, or NULL if there were
<span class="lineNum">    1297 </span>            :   // problems with the input (e.g. the message was invalid, or dependencies
<span class="lineNum">    1298 </span>            :   // were missing).  Details about the errors are written to GOOGLE_LOG(ERROR).
<span class="lineNum">    1299 </span>            :   const FileDescriptor* BuildFile(const FileDescriptorProto&amp; proto);
<span class="lineNum">    1300 </span>            : 
<span class="lineNum">    1301 </span>            :   // Same as BuildFile() except errors are sent to the given ErrorCollector.
<span class="lineNum">    1302 </span>            :   const FileDescriptor* BuildFileCollectingErrors(
<span class="lineNum">    1303 </span>            :     const FileDescriptorProto&amp; proto,
<span class="lineNum">    1304 </span>            :     ErrorCollector* error_collector);
<span class="lineNum">    1305 </span>            : 
<span class="lineNum">    1306 </span>            :   // By default, it is an error if a FileDescriptorProto contains references
<span class="lineNum">    1307 </span>            :   // to types or other files that are not found in the DescriptorPool (or its
<span class="lineNum">    1308 </span>            :   // backing DescriptorDatabase, if any).  If you call
<span class="lineNum">    1309 </span>            :   // AllowUnknownDependencies(), however, then unknown types and files
<span class="lineNum">    1310 </span>            :   // will be replaced by placeholder descriptors (which can be identified by
<span class="lineNum">    1311 </span>            :   // the is_placeholder() method).  This can allow you to
<span class="lineNum">    1312 </span>            :   // perform some useful operations with a .proto file even if you do not
<span class="lineNum">    1313 </span>            :   // have access to other .proto files on which it depends.  However, some
<span class="lineNum">    1314 </span>            :   // heuristics must be used to fill in the gaps in information, and these
<span class="lineNum">    1315 </span>            :   // can lead to descriptors which are inaccurate.  For example, the
<span class="lineNum">    1316 </span>            :   // DescriptorPool may be forced to guess whether an unknown type is a message
<span class="lineNum">    1317 </span>            :   // or an enum, as well as what package it resides in.  Furthermore,
<span class="lineNum">    1318 </span>            :   // placeholder types will not be discoverable via FindMessageTypeByName()
<span class="lineNum">    1319 </span>            :   // and similar methods, which could confuse some descriptor-based algorithms.
<span class="lineNum">    1320 </span>            :   // Generally, the results of this option should be handled with extreme care.
<span class="lineNum">    1321 </span>            :   void AllowUnknownDependencies() { allow_unknown_ = true; }
<span class="lineNum">    1322 </span>            : 
<span class="lineNum">    1323 </span>            :   // By default, weak imports are allowed to be missing, in which case we will
<span class="lineNum">    1324 </span>            :   // use a placeholder for the dependency and convert the field to be an Empty
<span class="lineNum">    1325 </span>            :   // message field. If you call EnforceWeakDependencies(true), however, the
<span class="lineNum">    1326 </span>            :   // DescriptorPool will report a import not found error.
<span class="lineNum">    1327 </span>            :   void EnforceWeakDependencies(bool enforce) { enforce_weak_ = enforce; }
<span class="lineNum">    1328 </span>            : 
<span class="lineNum">    1329 </span>            :   // Internal stuff --------------------------------------------------
<span class="lineNum">    1330 </span>            :   // These methods MUST NOT be called from outside the proto2 library.
<span class="lineNum">    1331 </span>            :   // These methods may contain hidden pitfalls and may be removed in a
<span class="lineNum">    1332 </span>            :   // future library version.
<span class="lineNum">    1333 </span>            : 
<span class="lineNum">    1334 </span>            :   // Create a DescriptorPool which is overlaid on top of some other pool.
<span class="lineNum">    1335 </span>            :   // If you search for a descriptor in the overlay and it is not found, the
<span class="lineNum">    1336 </span>            :   // underlay will be searched as a backup.  If the underlay has its own
<span class="lineNum">    1337 </span>            :   // underlay, that will be searched next, and so on.  This also means that
<span class="lineNum">    1338 </span>            :   // files built in the overlay will be cross-linked with the underlay's
<span class="lineNum">    1339 </span>            :   // descriptors if necessary.  The underlay remains property of the caller;
<span class="lineNum">    1340 </span>            :   // it must remain valid for the lifetime of the newly-constructed pool.
<span class="lineNum">    1341 </span>            :   //
<span class="lineNum">    1342 </span>            :   // Example:  Say you want to parse a .proto file at runtime in order to use
<span class="lineNum">    1343 </span>            :   // its type with a DynamicMessage.  Say this .proto file has dependencies,
<span class="lineNum">    1344 </span>            :   // but you know that all the dependencies will be things that are already
<span class="lineNum">    1345 </span>            :   // compiled into the binary.  For ease of use, you'd like to load the types
<span class="lineNum">    1346 </span>            :   // right out of generated_pool() rather than have to parse redundant copies
<span class="lineNum">    1347 </span>            :   // of all these .protos and runtime.  But, you don't want to add the parsed
<span class="lineNum">    1348 </span>            :   // types directly into generated_pool(): this is not allowed, and would be
<span class="lineNum">    1349 </span>            :   // bad design anyway.  So, instead, you could use generated_pool() as an
<span class="lineNum">    1350 </span>            :   // underlay for a new DescriptorPool in which you add only the new file.
<span class="lineNum">    1351 </span>            :   //
<span class="lineNum">    1352 </span>            :   // WARNING:  Use of underlays can lead to many subtle gotchas.  Instead,
<span class="lineNum">    1353 </span>            :   //   try to formulate what you want to do in terms of DescriptorDatabases.
<span class="lineNum">    1354 </span>            :   explicit DescriptorPool(const DescriptorPool* underlay);
<span class="lineNum">    1355 </span>            : 
<span class="lineNum">    1356 </span>            :   // Called by generated classes at init time to add their descriptors to
<span class="lineNum">    1357 </span>            :   // generated_pool.  Do NOT call this in your own code!  filename must be a
<span class="lineNum">    1358 </span>            :   // permanent string (e.g. a string literal).
<span class="lineNum">    1359 </span>            :   static void InternalAddGeneratedFile(
<span class="lineNum">    1360 </span>            :       const void* encoded_file_descriptor, int size);
<span class="lineNum">    1361 </span>            : 
<span class="lineNum">    1362 </span>            : 
<span class="lineNum">    1363 </span>            :   // For internal use only:  Gets a non-const pointer to the generated pool.
<span class="lineNum">    1364 </span>            :   // This is called at static-initialization time only, so thread-safety is
<span class="lineNum">    1365 </span>            :   // not a concern.  If both an underlay and a fallback database are present,
<span class="lineNum">    1366 </span>            :   // the underlay takes precedence.
<span class="lineNum">    1367 </span>            :   static DescriptorPool* internal_generated_pool();
<span class="lineNum">    1368 </span>            : 
<span class="lineNum">    1369 </span>            :   // For internal use only:  Changes the behavior of BuildFile() such that it
<span class="lineNum">    1370 </span>            :   // allows the file to make reference to message types declared in other files
<span class="lineNum">    1371 </span>            :   // which it did not officially declare as dependencies.
<span class="lineNum">    1372 </span>            :   void InternalDontEnforceDependencies();
<span class="lineNum">    1373 </span>            : 
<span class="lineNum">    1374 </span>            :   // For internal use only.
<span class="lineNum">    1375 </span>            :   void internal_set_underlay(const DescriptorPool* underlay) {
<span class="lineNum">    1376 </span>            :     underlay_ = underlay;
<span class="lineNum">    1377 </span>            :   }
<span class="lineNum">    1378 </span>            : 
<span class="lineNum">    1379 </span>            :   // For internal (unit test) use only:  Returns true if a FileDescriptor has
<span class="lineNum">    1380 </span>            :   // been constructed for the given file, false otherwise.  Useful for testing
<span class="lineNum">    1381 </span>            :   // lazy descriptor initialization behavior.
<span class="lineNum">    1382 </span>            :   bool InternalIsFileLoaded(const string&amp; filename) const;
<span class="lineNum">    1383 </span>            : 
<span class="lineNum">    1384 </span>            : 
<span class="lineNum">    1385 </span>            :   // Add a file to unused_import_track_files_. DescriptorBuilder will log
<span class="lineNum">    1386 </span>            :   // warnings for those files if there is any unused import.
<span class="lineNum">    1387 </span>            :   void AddUnusedImportTrackFile(const string&amp; file_name);
<span class="lineNum">    1388 </span>            :   void ClearUnusedImportTrackFiles();
<span class="lineNum">    1389 </span>            : 
<span class="lineNum">    1390 </span>            :  private:
<span class="lineNum">    1391 </span>            :   friend class Descriptor;
<span class="lineNum">    1392 </span>            :   friend class FieldDescriptor;
<span class="lineNum">    1393 </span>            :   friend class EnumDescriptor;
<span class="lineNum">    1394 </span>            :   friend class ServiceDescriptor;
<span class="lineNum">    1395 </span>            :   friend class FileDescriptor;
<span class="lineNum">    1396 </span>            :   friend class DescriptorBuilder;
<span class="lineNum">    1397 </span>            : 
<span class="lineNum">    1398 </span>            :   // Return true if the given name is a sub-symbol of any non-package
<span class="lineNum">    1399 </span>            :   // descriptor that already exists in the descriptor pool.  (The full
<span class="lineNum">    1400 </span>            :   // definition of such types is already known.)
<span class="lineNum">    1401 </span>            :   bool IsSubSymbolOfBuiltType(const string&amp; name) const;
<span class="lineNum">    1402 </span>            : 
<span class="lineNum">    1403 </span>            :   // Tries to find something in the fallback database and link in the
<span class="lineNum">    1404 </span>            :   // corresponding proto file.  Returns true if successful, in which case
<span class="lineNum">    1405 </span>            :   // the caller should search for the thing again.  These are declared
<span class="lineNum">    1406 </span>            :   // const because they are called by (semantically) const methods.
<span class="lineNum">    1407 </span>            :   bool TryFindFileInFallbackDatabase(const string&amp; name) const;
<span class="lineNum">    1408 </span>            :   bool TryFindSymbolInFallbackDatabase(const string&amp; name) const;
<span class="lineNum">    1409 </span>            :   bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type,
<span class="lineNum">    1410 </span>            :                                           int field_number) const;
<span class="lineNum">    1411 </span>            : 
<span class="lineNum">    1412 </span>            :   // Like BuildFile() but called internally when the file has been loaded from
<span class="lineNum">    1413 </span>            :   // fallback_database_.  Declared const because it is called by (semantically)
<span class="lineNum">    1414 </span>            :   // const methods.
<span class="lineNum">    1415 </span>            :   const FileDescriptor* BuildFileFromDatabase(
<span class="lineNum">    1416 </span>            :     const FileDescriptorProto&amp; proto) const;
<span class="lineNum">    1417 </span>            : 
<span class="lineNum">    1418 </span>            :   // If fallback_database_ is NULL, this is NULL.  Otherwise, this is a mutex
<span class="lineNum">    1419 </span>            :   // which must be locked while accessing tables_.
<span class="lineNum">    1420 </span>            :   Mutex* mutex_;
<span class="lineNum">    1421 </span>            : 
<span class="lineNum">    1422 </span>            :   // See constructor.
<span class="lineNum">    1423 </span>            :   DescriptorDatabase* fallback_database_;
<span class="lineNum">    1424 </span>            :   ErrorCollector* default_error_collector_;
<span class="lineNum">    1425 </span>            :   const DescriptorPool* underlay_;
<span class="lineNum">    1426 </span>            : 
<span class="lineNum">    1427 </span>            :   // This class contains a lot of hash maps with complicated types that
<span class="lineNum">    1428 </span>            :   // we'd like to keep out of the header.
<span class="lineNum">    1429 </span>            :   class Tables;
<span class="lineNum">    1430 </span>            :   scoped_ptr&lt;Tables&gt; tables_;
<span class="lineNum">    1431 </span>            : 
<span class="lineNum">    1432 </span>            :   bool enforce_dependencies_;
<span class="lineNum">    1433 </span>            :   bool allow_unknown_;
<span class="lineNum">    1434 </span>            :   bool enforce_weak_;
<span class="lineNum">    1435 </span>            :   std::set&lt;string&gt; unused_import_track_files_;
<span class="lineNum">    1436 </span>            : 
<span class="lineNum">    1437 </span>            :   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DescriptorPool);
<span class="lineNum">    1438 </span>            : };
<span class="lineNum">    1439 </span>            : 
<span class="lineNum">    1440 </span>            : // inline methods ====================================================
<span class="lineNum">    1441 </span>            : 
<span class="lineNum">    1442 </span>            : // These macros makes this repetitive code more readable.
<span class="lineNum">    1443 </span>            : #define PROTOBUF_DEFINE_ACCESSOR(CLASS, FIELD, TYPE) \
<span class="lineNum">    1444 </span>            :   inline TYPE CLASS::FIELD() const { return FIELD##_; }
<span class="lineNum">    1445 </span>            : 
<span class="lineNum">    1446 </span>            : // Strings fields are stored as pointers but returned as const references.
<span class="lineNum">    1447 </span>            : #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \
<span class="lineNum">    1448 </span>            :   inline const string&amp; CLASS::FIELD() const { return *FIELD##_; }
<span class="lineNum">    1449 </span>            : 
<span class="lineNum">    1450 </span>            : // Arrays take an index parameter, obviously.
<span class="lineNum">    1451 </span>            : #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \
<span class="lineNum">    1452 </span>            :   inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; }
<span class="lineNum">    1453 </span>            : 
<span class="lineNum">    1454 </span>            : #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \
<span class="lineNum">    1455 </span>            :   inline const TYPE&amp; CLASS::options() const { return *options_; }
<span class="lineNum">    1456 </span>            : 
<span class="lineNum">    1457 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name)
<span class="lineNum">    1458 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name)
<span class="lineNum">    1459 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*)
<span class="lineNum">    1460 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*)
<span class="lineNum">    1461 </span>            : 
<span class="lineNum">    1462 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, field_count, int)
<span class="lineNum">    1463 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, oneof_decl_count, int)
<span class="lineNum">    1464 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, nested_type_count, int)
<span class="lineNum">    1465 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, enum_type_count, int)
<span class="lineNum">    1466 </span>            : 
<span class="lineNum">    1467 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, field, const FieldDescriptor*)
<span class="lineNum">    1468 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, oneof_decl, const OneofDescriptor*)
<span class="lineNum">    1469 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, nested_type, const Descriptor*)
<span class="lineNum">    1470 </span><span class="lineCov">          7 : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, enum_type, const EnumDescriptor*)</span>
<span class="lineNum">    1471 </span>            : 
<span class="lineNum">    1472 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_range_count, int)
<span class="lineNum">    1473 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, extension_count, int)
<span class="lineNum">    1474 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension_range,
<span class="lineNum">    1475 </span>            :                                const Descriptor::ExtensionRange*)
<span class="lineNum">    1476 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(Descriptor, extension,
<span class="lineNum">    1477 </span>            :                                const FieldDescriptor*)
<span class="lineNum">    1478 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions);
<span class="lineNum">    1479 </span>            : PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool)
<span class="lineNum">    1480 </span>            : 
<span class="lineNum">    1481 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name)
<span class="lineNum">    1482 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name)
<span class="lineNum">    1483 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name)
<span class="lineNum">    1484 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name)
<span class="lineNum">    1485 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*)
<span class="lineNum">    1486 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int)
<span class="lineNum">    1487 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool)
<span class="lineNum">    1488 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, type, FieldDescriptor::Type)
<span class="lineNum">    1489 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label)
<span class="lineNum">    1490 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*)
<span class="lineNum">    1491 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof,
<span class="lineNum">    1492 </span>            :                          const OneofDescriptor*)
<span class="lineNum">    1493 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int)
<span class="lineNum">    1494 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*)
<span class="lineNum">    1495 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, message_type, const Descriptor*)
<span class="lineNum">    1496 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, enum_type, const EnumDescriptor*)
<span class="lineNum">    1497 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, experimental_map_key,
<span class="lineNum">    1498 </span>            :                          const FieldDescriptor*)
<span class="lineNum">    1499 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions)
<span class="lineNum">    1500 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool)
<span class="lineNum">    1501 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32 , int32 )
<span class="lineNum">    1502 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64 , int64 )
<span class="lineNum">    1503 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32)
<span class="lineNum">    1504 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64)
<span class="lineNum">    1505 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float , float )
<span class="lineNum">    1506 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double)
<span class="lineNum">    1507 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool  , bool  )
<span class="lineNum">    1508 </span>            : PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_enum,
<span class="lineNum">    1509 </span>            :                          const EnumValueDescriptor*)
<span class="lineNum">    1510 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string)
<span class="lineNum">    1511 </span>            : 
<span class="lineNum">    1512 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name)
<span class="lineNum">    1513 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name)
<span class="lineNum">    1514 </span>            : PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*)
<span class="lineNum">    1515 </span>            : PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int)
<span class="lineNum">    1516 </span>            : 
<span class="lineNum">    1517 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name)
<span class="lineNum">    1518 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name)
<span class="lineNum">    1519 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*)
<span class="lineNum">    1520 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*)
<span class="lineNum">    1521 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int)
<span class="lineNum">    1522 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, value,
<span class="lineNum">    1523 </span>            :                                const EnumValueDescriptor*)
<span class="lineNum">    1524 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumDescriptor, EnumOptions);
<span class="lineNum">    1525 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, is_placeholder, bool)
<span class="lineNum">    1526 </span>            : 
<span class="lineNum">    1527 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name)
<span class="lineNum">    1528 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name)
<span class="lineNum">    1529 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int)
<span class="lineNum">    1530 </span>            : PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*)
<span class="lineNum">    1531 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions)
<span class="lineNum">    1532 </span>            : 
<span class="lineNum">    1533 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name)
<span class="lineNum">    1534 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name)
<span class="lineNum">    1535 </span>            : PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*)
<span class="lineNum">    1536 </span>            : PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int)
<span class="lineNum">    1537 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method,
<span class="lineNum">    1538 </span>            :                                const MethodDescriptor*)
<span class="lineNum">    1539 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions);
<span class="lineNum">    1540 </span>            : 
<span class="lineNum">    1541 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name)
<span class="lineNum">    1542 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name)
<span class="lineNum">    1543 </span>            : PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*)
<span class="lineNum">    1544 </span>            : PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, input_type, const Descriptor*)
<span class="lineNum">    1545 </span>            : PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, output_type, const Descriptor*)
<span class="lineNum">    1546 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions);
<span class="lineNum">    1547 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, name)
<span class="lineNum">    1548 </span>            : PROTOBUF_DEFINE_STRING_ACCESSOR(FileDescriptor, package)
<span class="lineNum">    1549 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, pool, const DescriptorPool*)
<span class="lineNum">    1550 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, dependency_count, int)
<span class="lineNum">    1551 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, public_dependency_count, int)
<span class="lineNum">    1552 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, weak_dependency_count, int)
<span class="lineNum">    1553 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, message_type_count, int)
<span class="lineNum">    1554 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, enum_type_count, int)
<span class="lineNum">    1555 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, service_count, int)
<span class="lineNum">    1556 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, extension_count, int)
<span class="lineNum">    1557 </span>            : PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FileDescriptor, FileOptions);
<span class="lineNum">    1558 </span>            : PROTOBUF_DEFINE_ACCESSOR(FileDescriptor, is_placeholder, bool)
<span class="lineNum">    1559 </span>            : 
<span class="lineNum">    1560 </span><span class="lineCov">         62 : PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, message_type, const Descriptor*)</span>
<span class="lineNum">    1561 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, enum_type, const EnumDescriptor*)
<span class="lineNum">    1562 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, service,
<span class="lineNum">    1563 </span>            :                                const ServiceDescriptor*)
<span class="lineNum">    1564 </span>            : PROTOBUF_DEFINE_ARRAY_ACCESSOR(FileDescriptor, extension,
<span class="lineNum">    1565 </span>            :                                const FieldDescriptor*)
<span class="lineNum">    1566 </span>            : 
<span class="lineNum">    1567 </span>            : #undef PROTOBUF_DEFINE_ACCESSOR
<span class="lineNum">    1568 </span>            : #undef PROTOBUF_DEFINE_STRING_ACCESSOR
<span class="lineNum">    1569 </span>            : #undef PROTOBUF_DEFINE_ARRAY_ACCESSOR
<span class="lineNum">    1570 </span>            : 
<span class="lineNum">    1571 </span>            : // A few accessors differ from the macros...
<span class="lineNum">    1572 </span>            : 
<span class="lineNum">    1573 </span>            : inline bool Descriptor::IsExtensionNumber(int number) const {
<span class="lineNum">    1574 </span>            :   return FindExtensionRangeContainingNumber(number) != NULL;
<span class="lineNum">    1575 </span>            : }
<span class="lineNum">    1576 </span>            : 
<span class="lineNum">    1577 </span>            : inline bool FieldDescriptor::is_required() const {
<span class="lineNum">    1578 </span>            :   return label() == LABEL_REQUIRED;
<span class="lineNum">    1579 </span>            : }
<span class="lineNum">    1580 </span>            : 
<span class="lineNum">    1581 </span>            : inline bool FieldDescriptor::is_optional() const {
<span class="lineNum">    1582 </span>            :   return label() == LABEL_OPTIONAL;
<span class="lineNum">    1583 </span>            : }
<span class="lineNum">    1584 </span>            : 
<span class="lineNum">    1585 </span>            : inline bool FieldDescriptor::is_repeated() const {
<span class="lineNum">    1586 </span>            :   return label() == LABEL_REPEATED;
<span class="lineNum">    1587 </span>            : }
<span class="lineNum">    1588 </span>            : 
<span class="lineNum">    1589 </span>            : inline bool FieldDescriptor::is_packable() const {
<span class="lineNum">    1590 </span>            :   return is_repeated() &amp;&amp; IsTypePackable(type());
<span class="lineNum">    1591 </span>            : }
<span class="lineNum">    1592 </span>            : 
<span class="lineNum">    1593 </span>            : // To save space, index() is computed by looking at the descriptor's position
<span class="lineNum">    1594 </span>            : // in the parent's array of children.
<span class="lineNum">    1595 </span>            : inline int FieldDescriptor::index() const {
<span class="lineNum">    1596 </span>            :   if (!is_extension_) {
<span class="lineNum">    1597 </span>            :     return static_cast&lt;int&gt;(this - containing_type_-&gt;fields_);
<span class="lineNum">    1598 </span>            :   } else if (extension_scope_ != NULL) {
<span class="lineNum">    1599 </span>            :     return static_cast&lt;int&gt;(this - extension_scope_-&gt;extensions_);
<span class="lineNum">    1600 </span>            :   } else {
<span class="lineNum">    1601 </span>            :     return static_cast&lt;int&gt;(this - file_-&gt;extensions_);
<span class="lineNum">    1602 </span>            :   }
<span class="lineNum">    1603 </span>            : }
<span class="lineNum">    1604 </span>            : 
<span class="lineNum">    1605 </span>            : inline int Descriptor::index() const {
<span class="lineNum">    1606 </span>            :   if (containing_type_ == NULL) {
<span class="lineNum">    1607 </span>            :     return static_cast&lt;int&gt;(this - file_-&gt;message_types_);
<span class="lineNum">    1608 </span>            :   } else {
<span class="lineNum">    1609 </span>            :     return static_cast&lt;int&gt;(this - containing_type_-&gt;nested_types_);
<span class="lineNum">    1610 </span>            :   }
<span class="lineNum">    1611 </span>            : }
<span class="lineNum">    1612 </span>            : 
<span class="lineNum">    1613 </span>            : inline int OneofDescriptor::index() const {
<span class="lineNum">    1614 </span>            :   return static_cast&lt;int&gt;(this - containing_type_-&gt;oneof_decls_);
<span class="lineNum">    1615 </span>            : }
<span class="lineNum">    1616 </span>            : 
<span class="lineNum">    1617 </span>            : inline int EnumDescriptor::index() const {
<span class="lineNum">    1618 </span>            :   if (containing_type_ == NULL) {
<span class="lineNum">    1619 </span>            :     return static_cast&lt;int&gt;(this - file_-&gt;enum_types_);
<span class="lineNum">    1620 </span>            :   } else {
<span class="lineNum">    1621 </span>            :     return static_cast&lt;int&gt;(this - containing_type_-&gt;enum_types_);
<span class="lineNum">    1622 </span>            :   }
<span class="lineNum">    1623 </span>            : }
<span class="lineNum">    1624 </span>            : 
<span class="lineNum">    1625 </span>            : inline int EnumValueDescriptor::index() const {
<span class="lineNum">    1626 </span>            :   return static_cast&lt;int&gt;(this - type_-&gt;values_);
<span class="lineNum">    1627 </span>            : }
<span class="lineNum">    1628 </span>            : 
<span class="lineNum">    1629 </span>            : inline int ServiceDescriptor::index() const {
<span class="lineNum">    1630 </span>            :   return static_cast&lt;int&gt;(this - file_-&gt;services_);
<span class="lineNum">    1631 </span>            : }
<span class="lineNum">    1632 </span>            : 
<span class="lineNum">    1633 </span>            : inline int MethodDescriptor::index() const {
<span class="lineNum">    1634 </span>            :   return static_cast&lt;int&gt;(this - service_-&gt;methods_);
<span class="lineNum">    1635 </span>            : }
<span class="lineNum">    1636 </span>            : 
<span class="lineNum">    1637 </span>            : inline const char* FieldDescriptor::type_name() const {
<span class="lineNum">    1638 </span>            :   return kTypeToName[type_];
<span class="lineNum">    1639 </span>            : }
<span class="lineNum">    1640 </span>            : 
<span class="lineNum">    1641 </span>            : inline FieldDescriptor::CppType FieldDescriptor::cpp_type() const {
<span class="lineNum">    1642 </span>            :   return kTypeToCppTypeMap[type_];
<span class="lineNum">    1643 </span>            : }
<span class="lineNum">    1644 </span>            : 
<span class="lineNum">    1645 </span>            : inline const char* FieldDescriptor::cpp_type_name() const {
<span class="lineNum">    1646 </span>            :   return kCppTypeToName[kTypeToCppTypeMap[type_]];
<span class="lineNum">    1647 </span>            : }
<span class="lineNum">    1648 </span>            : 
<span class="lineNum">    1649 </span>            : inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) {
<span class="lineNum">    1650 </span>            :   return kTypeToCppTypeMap[type];
<span class="lineNum">    1651 </span>            : }
<span class="lineNum">    1652 </span>            : 
<span class="lineNum">    1653 </span>            : inline const char* FieldDescriptor::TypeName(Type type) {
<span class="lineNum">    1654 </span>            :   return kTypeToName[type];
<span class="lineNum">    1655 </span>            : }
<span class="lineNum">    1656 </span>            : 
<span class="lineNum">    1657 </span>            : inline const char* FieldDescriptor::CppTypeName(CppType cpp_type) {
<span class="lineNum">    1658 </span>            :   return kCppTypeToName[cpp_type];
<span class="lineNum">    1659 </span>            : }
<span class="lineNum">    1660 </span>            : 
<span class="lineNum">    1661 </span>            : inline bool FieldDescriptor::IsTypePackable(Type field_type) {
<span class="lineNum">    1662 </span>            :   return (field_type != FieldDescriptor::TYPE_STRING &amp;&amp;
<span class="lineNum">    1663 </span>            :           field_type != FieldDescriptor::TYPE_GROUP &amp;&amp;
<span class="lineNum">    1664 </span>            :           field_type != FieldDescriptor::TYPE_MESSAGE &amp;&amp;
<span class="lineNum">    1665 </span>            :           field_type != FieldDescriptor::TYPE_BYTES);
<span class="lineNum">    1666 </span>            : }
<span class="lineNum">    1667 </span>            : 
<span class="lineNum">    1668 </span>            : inline const FileDescriptor* FileDescriptor::dependency(int index) const {
<span class="lineNum">    1669 </span>            :   return dependencies_[index];
<span class="lineNum">    1670 </span>            : }
<span class="lineNum">    1671 </span>            : 
<span class="lineNum">    1672 </span>            : inline const FileDescriptor* FileDescriptor::public_dependency(
<span class="lineNum">    1673 </span>            :     int index) const {
<span class="lineNum">    1674 </span>            :   return dependencies_[public_dependencies_[index]];
<span class="lineNum">    1675 </span>            : }
<span class="lineNum">    1676 </span>            : 
<span class="lineNum">    1677 </span>            : inline const FileDescriptor* FileDescriptor::weak_dependency(
<span class="lineNum">    1678 </span>            :     int index) const {
<span class="lineNum">    1679 </span>            :   return dependencies_[weak_dependencies_[index]];
<span class="lineNum">    1680 </span>            : }
<span class="lineNum">    1681 </span>            : 
<span class="lineNum">    1682 </span>            : // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array
<span class="lineNum">    1683 </span>            : // of pointers rather than the usual array of objects.
<span class="lineNum">    1684 </span>            : inline const FieldDescriptor* OneofDescriptor::field(int index) const {
<span class="lineNum">    1685 </span>            :   return fields_[index];
<span class="lineNum">    1686 </span>            : }
<span class="lineNum">    1687 </span>            : 
<span class="lineNum">    1688 </span>            : }  // namespace protobuf
<span class="lineNum">    1689 </span>            : 
<span class="lineNum">    1690 </span>            : }  // namespace google
<span class="lineNum">    1691 </span>            : #endif  // GOOGLE_PROTOBUF_DESCRIPTOR_H__
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
